Hello, It does help ! Thank you very much Vincent On Mon, 4 Jul 2005, Travis Spencer wrote: > On 7/4/05, Vincent Torri <Vincent.Torri@xxxxxxxxxxxxxxx> wrote: > > > > Hello, > > Hey, Vincent. > > > I have the following class: > > > > template <typename T, typename Synchronizer = synchronizer::None, typename > > Creator = T * (*)()> > > class value_cache > > { > > *** > > > > public: //interface > > > > boost::shared_ptr<T> Get() const > > { > > Synchronizer synchronizer(); > > > > *** > > *** > > } > > }; > > > > But gcc reports this error message at compile time: > > > > "default template arguments may not be used in function templates" > > > > for the declaration of synchronizer(). > > > > I use gcc 3.3.4 > > You can't use the default arguments in the function declaration (see > http://tinyurl.com/bvnbx). To get around this, declare the class > methods in the header file like normal, but define them after the > class declaration (in the same header file) kinda like this: > > // -*- mode: c++ -*- > // value_cache.h > #include <boost/shared_ptr.hpp> > > class synchronizer { > class None { }; > }; > > template <typename T, typename Synchronizer = synchronizer::None, > typename Creator = T * (*)() > > class value_cache > { > public: > typedef boost::shared_ptr<T> SharedPtr; > > SharedPtr Get() const; > }; > > #define ValueCache value_cache<class T, class Synchronizer, class Creator> > > inline ValueCache::SharedPtr ValueCache::Get() const > { > Synchronizer synchronizer(); > } > > HTH. > > -- > > Regards, > > Travis Spencer > Portland, OR USA >