From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexandre Oliva To: Nathan Myers Cc: egcs@cygnus.com Subject: Re: explicit specialization in non-namespace scope Date: Tue, 22 Sep 1998 06:35:00 -0000 Message-id: References: <3606BFC2.D2A647E1@cygnus.com> X-SW-Source: 1998-09/msg01239.html Nathan Myers writes: >> > An explicit specialization of a member >> > function, member class or static data member of a class template >> > shall be declared in the namespace of which the class template >> > is a member. */ > It's still not clear that the above text applies to the case mentioned. > "In the namespace of which the enclosing class is a member" is satisified > both outside and inside the class. When it means to say "not in a class > or in a block", it says "at namespace scope" or sometimes "in namespace > scope" > Anyhow, all is not lost. You can specialize this member anyway, > even in egcs with bug added, just not as cleanly as you wanted: > struct A { > template inline int factorial(); > }; > template <> inline int A::f<0>() { return 1; } > template inline void A::f() { return f() * I; } Unfortunately, this won't work if A is a template class, because, AFAIK, in order to specialize A<...>::factorial, A<...> must be fully specialized. -- Alexandre Oliva mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org http://www.dcc.unicamp.br/~oliva Universidade Estadual de Campinas, SP, Brasil