templates
Adrian Sandor
aditsu@yahoo.com
Tue Feb 11 07:59:00 GMT 2003
let's say I have a simple template function:
template<class T>T sqr(T x){return x*x;}
then if I write "sqr(5)" then everything is ok
but if I make some changes:
template<class T>struct dummy{typedef T type;};
template<class T>T sqr(typename dummy<T>::type
x){return x*x;}
then "sqr(5)" doesn't compile anymore; instead I have
to write "sqr<int>(5)"
what is the cause of this behaviour and how can I
avoid it? (I need to use some type traits)
thanks
Adrian
__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
More information about the Gcc-help
mailing list