2013年8月19日

C++0x对局部静态初始化作出了线程安全的要求,singleton的写法可以回归到最原始的方式

摘要: class Foo{public: staticFoo& instance(void) { static Foo s_instance; return s_instance; }};以下摘自ISOIEC 14882 C++116.7.4The zero-initialization (8.5) of all block-scope variables with static storage duration (3.7.1) or thread storage duration (3.7.2) is performed before any othe... 阅读全文

posted @ 2013-08-19 17:39 rickerliang 阅读(389) 评论(0) 推荐(0) 编辑

导航