|
From: Luigi B. <lui...@gm...> - 2010-09-01 08:35:11
|
On Sat, 2010-08-14 at 20:14 -0500, Kakhkhor Abdijalilov wrote:
> Somehow static non-const local variables and templates don't mix on
> ICC. I modified the original implementation to uses const static
> variable and everything worked well. The new implementation is
> attached.
Kakhkhor,
do you also need the scoped_ptr below? Would a simple static const
map_type work?
Luigi
> //-----------------------------------------
> template <class T>
> class Singleton : private boost::noncopyable {
> ...
> private:
> typedef std::map<Integer, boost::shared_ptr<T> > map_type;
> static const boost::scoped_ptr<map_type> instances_;
> };
>
> template <typename T>
> const boost::scoped_ptr<Singleton<T>::map_type>
> Singleton<T>::instances_(new Singleton<T>::map_type);
--
The First Rule of Optimization: Don't do it.
The Second Rule of Optimization (For experts only): Don't do it yet.
-- Michael Jackson
|