Specialisation of a template that results to another template

N

Nicolas Weidmann

Hi,

I can compile the following code under g++ (using the -std=c++98), but not under
MS VC7.0 (.NET).

Is it illegal code or is it a limitation of the MS compiler?

Thank you.

Nicolas

template<class T> class Foo {
public:
T value;
};

namespace std {
template<class T> less<Foo<T> > {
bool operator ()(const Foo<T> &left, const Foo<T> &right) const
{
return left.value < right.value;
}
}
};

void bar()
{
std::set<Foo<int> > hello;
}
 
C

Christian Jaeger

Is it illegal code or is it a limitation of the MS compiler?

I'd say the latter: VC7.0 does not support partial specialisations. VC
7.1 does. It compiles your code. (After you correct the two typos :) )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top