www.digitalmars.com         C & C++   DMDScript  

c++.beta - function template specialization

reply Richard Grant <fractal clark.net> writes:
Congrats.. the getters and setters for tuples are working. However, conditional
expressions  - well, looks like a problem with function template specialization.

struct null_type { };

template <class T1, class T2>
int fn(const T1& left, const T2& right) {
return 0;
}
template <>
int fn<null_type,null_type>(const null_type&, const null_type&) {
//Error: 'fn' is not a class template
return 1;
}

int main() { }

Richard
Apr 03 2003
parent "Walter" <walter digitalmars.com> writes:
DMC doesn't do explicit specialization for function templates yet.

"Richard Grant" <fractal clark.net> wrote in message
news:b6hs9p$gd0$1 digitaldaemon.com...
 Congrats.. the getters and setters for tuples are working. However,
conditional
 expressions  - well, looks like a problem with function template
specialization.
 struct null_type { };

 template <class T1, class T2>
 int fn(const T1& left, const T2& right) {
 return 0;
 }
 template <>
 int fn<null_type,null_type>(const null_type&, const null_type&) {
 //Error: 'fn' is not a class template
 return 1;
 }

 int main() { }

 Richard
Apr 05 2003