This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: template specializiation


Thomas,

Would this not work for you?

struct A
{
 const A* a;
};

template <const char* c>
struct B
{
 static const A b;
};

extern const char c[1]="";
extern const char d[1]="";

template<> const A B<d>::b;
template<> const A B<c>::b;

template<>
const A B<c>::b =
{
 &B<d>::b
};

template<>
const A B<d>::b = 
{
 &B<c>::b
};

corey

On 7/7/05, Thomas Neumann <tneumann@users.sourceforge.net> wrote:
> Hi,
> 
> 
> > If a template, a member template or the member of a class template is
> > explicitly specialized then that specialization
> > shall be declared before the first use of that specialization that
> but how would I do this? For functions this is easy, but I don't think I
> can declare a static member variable without defining it at the same
> time. I tried some combinations (using extern etc.), but always got
> compiler errors.
> 
> Thomas
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]