[ This is a question that I posted in comp.lang.c++.moderated ]
[ about ten days ago and got no responses to. :-) ]
[ I guess comp.std.c++ is more appropriate for this subject. ]
In a template which takes a class/typename C,
if C::member is a type, we should write 'typename C::member', and
if C::member is a template, we should write 'C::template member'
and 'c.template member' where c is of type C.
Thus, 'typename' comes before 'C::' but 'template' after 'C::'.
Why does C++ have this inconsistency? Just by chance or mistake?
// Example:
struct C
{
typedef int type;
template<typename T> void nonstatic_template_func(const T*);
template<typename T> static void static_template_func(const T*);
template<class C> void f()Quote:};
{
C().template nonstatic_template_func<typename C::type>(0);
C::template static_template_func<typename C::type>(0);
// End exampleQuote:}
--
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]