Boost logo

Boost :

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


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

Bernd Martin Wollny wrote:
> 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;


Boost list run by bdawes at, gregod at, cpdaniel at, john at