Fix some compilation errors on Mac OS X
[lsnes.git] / include / library / temporary_handle.hpp
blobd998e54115551e10109b7f243d668e9f8857510b
1 #ifndef _library__temporary_handle__hpp__included__
2 #define _library__temporary_handle__hpp__included__
4 template<typename T>
5 class temporary_handle
7 public:
8 template<typename... A> temporary_handle(A... args)
10 ptr = new T(args...);
12 ~temporary_handle()
14 delete ptr;
16 T* get()
18 return ptr;
20 T* operator()()
22 T* t = NULL;
23 std::swap(t, ptr);
24 return t;
26 private:
27 T* ptr;
28 temporary_handle(const temporary_handle&);
29 temporary_handle& operator=(const temporary_handle&);
32 #endif