SAGA Adaptor CPI v.1.0
singleton.hpp
Go to the documentation of this file.
00001 
00002 #ifndef SAGA_UTIL_SINGLETON
00003 #define SAGA_UTIL_SINGLETON
00004 
00005 #include <boost/spirit/core/non_terminal/impl/static.hpp>
00006 
00007 namespace saga
00008 {
00009   namespace adaptors
00010   {
00011     namespace utils
00012     {
00013       struct singleton_tag {};
00014 
00015       // avoid to be optimized away
00016       template <class Singleton>
00017       Singleton & get_singleton (void)
00018       {
00019         boost::spirit::static_ <Singleton, singleton_tag> singleton_;
00020         return singleton_.get ();
00021       }
00022     }
00023   }
00024 }
00025 
00026 #endif // SAGA_UTIL_SINGLETON
00027 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines