lsnes/generic/globalwrap.hpp
2011-09-24 20:53:37 +03:00

18 lines
254 B
C++

#ifndef _globalwrap__hpp__included__
#define _globalwrap__hpp__included__
template<class T>
class globalwrap
{
public:
T& operator()() throw(std::bad_alloc)
{
if(!storage)
storage = new T();
return *storage;
}
private:
T* storage;
};
#endif