Boost logo

Boost :

From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2005-11-11 09:37:13


Bernd,

this question should go to some C++ newsgroup, as it is only vaguely
related to boost.

Bernd Martin Wollny wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
> Hello,
> I tried to declare a boost:shared_ptr as a static member of a template
> function. If I compile the program with Visual Studio all are Ok. If I try
> to compile the code with gcc, gcc failed with:
>
> t1.cpp:71: error: too few template-parameter-lists
> t1.cpp:72: error: too few template-parameter-lists
>
> There is a small mistake in my code but I can't find the error.
>
> Can someone help me?

You define members of a class template, which thus is a template declaration.
You are thus missing a template-parameter-list, just as the compiler tells you:

> boost::shared_ptr<test> SimpleSingleton<test>::as;
> boost::mutex SimpleSingleton<test>::inst_mutex;

should be:

template <> boost::shared_ptr<test> SimpleSingleton<test>::as;
template <> boost::mutex SimpleSingleton<test>::inst_mutex;

Regards,
                Stefan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk