LosaDev source snapshot 2019
This commit is contained in:
commit
c198676e97
20588 files changed
+8812878
No files matched your search
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
template< typename T >
|
||||
class ioSingleton
|
||||
{
|
||||
private:
|
||||
~ioSingleton() { };
|
||||
ioSingleton() { };
|
||||
ioSingleton( const T& other ) { };
|
||||
T& operator=( const T& other ) { };
|
||||
|
||||
public:
|
||||
inline static T* instance();
|
||||
|
||||
static boost::shared_ptr< T > pInstance;
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
boost::shared_ptr< T > ioSingleton< T >::pInstance;
|
||||
|
||||
template< typename T >
|
||||
T* ioSingleton< T >::instance()
|
||||
{
|
||||
if( 0 == pInstance )
|
||||
pInstance.reset( new T );
|
||||
|
||||
return pInstance.get();
|
||||
}
|
||||
Reference in new issue
Block a user