#ifndef LEAKY_SINGLETON_INL_H_ #error "Direct inclusion of this file is not allowed, include leaky_singleton.h" // For the sake of sane code completion. #include "leaky_singleton.h" #endif namespace NYT { //////////////////////////////////////////////////////////////////////////////// template TLeakyStorage::TLeakyStorage() { new (Get()) T(); } template T* TLeakyStorage::Get() { return reinterpret_cast(Buffer_); } //////////////////////////////////////////////////////////////////////////////// template T* LeakySingleton() { static TLeakyStorage Storage; return Storage.Get(); } //////////////////////////////////////////////////////////////////////////////// } // namespace NYT