c++ - Why is it not possible to define a fully-qualified function within a foreign namespace? May I know what the standard says? -
is wrong? why? may know standard says?
namespace n{ namespace n1{ namespace n2{ struct a{ struct b{ void fun(); };//b }; //a } //n2 }//n1 namespace n3{ void n1::n2::a::b::fun(){} //error }//n3 }//n int main() { return 0; }
may know why failing?
this invalid due §9.3/2:
a member function definition appears outside of class definition shall appear in namespace scope enclosing class definition.
the scope of namespace n3
not enclose definition of class b
Comments
Post a Comment