
"Robert Ramey" <ramey@rrsd.com> writes:
Hmmm - here is a situation that I come across:
class my_archive { .... };
template<class Arg> class my_templated_archive{ };
template<class Archive, T> void serialize(Archive & ar, T &t, const unsigned int version){ ... ar.template register_type<T>(); // ok - I think ... }
Correct.
void serialize(my_archive & ar, T &t, const unsigned int version){ ... ar.template register_type<T>(); // syntax error? or not? ... }
Syntax error, at least unless and until the committee relaxes the rules. my_archive is not a dependent type.
Truth is I can't never keep these kinds of rules straight.
It's pretty simple: does the type of ar depend on a template parameter? If so, we don't know whether ar.register_type is a value or a class template and template is required. If not, we can simply look at the type of ar and determine whether register_type is a template or not, and the template keyword is forbidden. -- Dave Abrahams Boost Consulting www.boost-consulting.com