12 #ifndef ROC_CORE_SINGLETON_H_
13 #define ROC_CORE_SINGLETON_H_
30 uv_once(&once_, create_);
40 static void create_() {
41 instance_ =
new (storage_.mem) T();
44 static uv_once_t once_;
45 static Storage storage_;
49 template <
class T> uv_once_t Singleton<T>::once_ = UV_ONCE_INIT;
50 template <
class T>
typename Singleton<T>::Storage Singleton<T>::storage_;
51 template <
class T> T* Singleton<T>::instance_;
Base class for non-copyable objects.
static T & instance()
Get singleton instance.
A union with maximum possible allignment.