UniShader
1.0.0a
Interface for GPGPU and working with shader programs
|
00001 #pragma once 00002 #ifndef SHARED_PTR_H 00003 #define SHARED_PTR_H 00004 #include <UniShader/Config.h> 00005 #include <UniShader/Utility.h> 00006 00007 #include <memory> 00008 00009 UNISHADER_BEGIN 00010 00012 00021 template<class T> 00022 class SafePtr : protected std::weak_ptr<T>{ 00023 public: 00024 SafePtr(); 00025 SafePtr(const std::shared_ptr<T>& shared); 00026 00028 00031 T* operator->(); 00032 00034 00037 T& operator*(); 00038 00040 00043 SafePtr& operator=(const std::shared_ptr<T>& shared); 00044 00046 00049 operator bool(); 00050 }; 00051 00052 UNISHADER_END 00053 00054 #include <UniShader/SafePtr.inl> 00055 00056 #endif