From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Myers To: egcs@cygnus.com Subject: Re: explicit specialization in non-namespace scope Date: Tue, 22 Sep 1998 19:41:00 -0000 Message-id: <360808F9.4954F804@cygnus.com> References: X-SW-Source: 1998-09/msg01270.html Alexandre Oliva wrote: > > Nathan Myers writes: > > ... 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. This can be got around by defining a helper function template specialized to call a nontemplate member. The extra declarations are unpleasant but need not be exposed to users. Nathan Myers ncm@cantrip.org