$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] Review Request: Singularity
From: Sergey Cheban (s.cheban_at_[hidden])
Date: 2011-08-28 05:43:00
23.08.2011 1:15, Mathias Gaunard пиÑеÑ:
> Apart from that I'm afraid I don't really see the point of this against
>
> struct my_singleton
> {
> private:
> my_singleton() {}
> my_singleton(const my_singleton&);
>
> public:
> static my_singleton& instance()
> {
> static my_singleton ins;
> return ins;
> }
> };
>
> which is simple, short, fast to compile, and thread-safe.
AFAIK the "static my_singleton ins;" is not thread-safe (at least, for
the MSVC compilers).
http://blogs.msdn.com/b/oldnewthing/archive/2004/03/08/85901.aspx
-- Best regards, Sergey Cheban