templates - C++ using statement in member function scope -
if want use member of template base class template derived class, have bring scope such:
template <typename t> struct base {     void foo(); };  template <typename t> struct derived : base<t> {     using base<t>::foo; }; why can't place using statement local scope, other using statements?
template <typename t> struct base {     void foo(); };  template <typename t> struct derived : base<t> {     void f()     {         using base<t>::foo;  // error: base<t> not namespace     } }; 
the standard (draft 3225) says in [namespace.udecl]:
a using-declaration class member shall member-declaration. [ example:
struct  x  {     int  i;     static  int  s; }; void  f()  {     using  x::i; // error:  x::i class member                  // , not member declaration.     using  x::s; // error:  x::s class member                  // , not member declaration. } — end example ]
a using-directive has no such restriction, ([namespace.udir]):
when looking namespace-name in using-directive, namespace names considered
Comments
Post a Comment