TITLE: the ".template" construct (Newsgroups: comp.lang.c++.moderated, 2 Jun 97)a NORTEL: beaurega_@nortel.com > |> Is it legal for one member function of a class to be a template > |> function without the class itself being a template? If so, what > |> is the syntax for this? If not, why not? VANDEVOORDE: David Vandevoorde Yes, you can do it (for non-virtual members, that is): struct S { template void foo(); }; template void S::foo() { // ... } The above example is in fact particularly nasty because you need explicit template argument specification when you want to make use S::foo<..>: void g(S& s) { s.template foo(); } The `.template' construct is needed to disambiguate the `<' (template delimiter or less-than?); one of the many unfortunate consequences of a poor choice for template argument delimiters. I know of two compilers (HP & EDG) that can handle this sort of code, but there might be a few more. [snip]