Connecting Tech Pros Worldwide Forums | Help | Site Map

Specialisation of a template that results to another template

Nicolas Weidmann
Guest
 
Posts: n/a
#1: Jul 22 '05
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;
}

Christian Jaeger
Guest
 
Posts: n/a
#2: Jul 22 '05

re: Specialisation of a template that results to another template


> 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 :) )

Closed Thread