www.digitalmars.com         C & C++   DMDScript  

c++ - prefix member template name with template keyword

struct A
{
  template<int> static void f();
  // Error: no identifier for declarator
};

template<class T> void g(T t)
{
  T::template f<1>();
  // Error: identifier expected
}

int main()
{
  g(A());

  return 0;
}


See 14.2 Names of template specializations [temp.names], paragraph 4, of the
C++ standard.

As a workaround (for Boost) you can define BOOST_NO_MEMBER_TEMPLATE_KEYWORD,
but this doesn't always work because not all libraries use
BOOST_NESTED_TEMPLATE (which is defined depending on
BOOST_NO_MEMBER_TEMPLATE_KEYWORD) instead of a hardcoded "template". So it's
not really a showstopper, but it is a bit annoying.


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw jabber.at
mailto cmeerw at web.de

...and what have you contributed to the Net?
Dec 22 2002