Show singleton.h syntax highlighted
#ifndef __GEN_PROG_PLUGIN_DETAIL_SINGLETON_H__
#define __GEN_PROG_PLUGIN_DETAIL_SINGLETON_H__ 1
#include <memory>
#include <osgDesigner/core/Export.h>
namespace gen_prog
{
namespace plugin
{
namespace detail
{
template < typename T >
class OSGDESIGNER_EXPORT singleton
{
public:
typedef T singleton_type;
static T * instance()
{
static std::auto_ptr< singleton_type > _instance(new singleton_type);
create_object.do_nothing();
return (_instance.get());
};
private:
singleton();
struct object_creator
{
object_creator() { singleton<T>::instance(); }
inline void do_nothing() const {}
};
static object_creator create_object;
};
template < typename T >
typename singleton<T>::object_creator singleton<T>::create_object;
}
}
}
#endif // ** __GEN_PROG_PLUGIN_DETAIL_SINGLETON_H__ ** //
See more files for this project here