diff options
Diffstat (limited to 'source/core/smart-pointer.h')
| -rw-r--r-- | source/core/smart-pointer.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/core/smart-pointer.h b/source/core/smart-pointer.h index bc1683a5b..4c6744d1b 100644 --- a/source/core/smart-pointer.h +++ b/source/core/smart-pointer.h @@ -6,6 +6,8 @@ #include <assert.h> +#include "../../slang.h" + namespace Slang { // TODO: Need to centralize these typedefs @@ -199,13 +201,17 @@ namespace Slang T* detach() { - if (pointer) - dynamic_cast<RefObject*>(pointer)->decreaseReference(); auto rs = pointer; pointer = nullptr; return rs; } + /// Get ready for writing (nulls contents) + SLANG_FORCE_INLINE T** writeRef() { *this = nullptr; return &pointer; } + + /// Get for read access + SLANG_FORCE_INLINE T*const* readRef() const { return &pointer; } + private: T* pointer; |
