简体   繁体   中英

How to use boost singleton

I am a newbie to boost.I find that there two ways to use boost::singleton.Code pasted below:

// First 
class Foo {};
#define FooInstane singleton_default<Foo>::instance()

// second 
class Bar : public singleton_default<Bar> {};
#define BarInstance Bar::instance()

I think both are OK.But I cannot find some authoritative conclusion.

Question: Which one is right? Or both right(Then which one is better)?

The doc of boost::singleton can be find here .

Neither. The class does not exist any more.

The class was never intended for users. It was only for internal purposes of the Boost.Pool library and was apparently removed. There are some other singleton classes, but all are hidden in the private details of various components.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM