summaryrefslogtreecommitdiffstats
path: root/source/core/smart-pointer.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/smart-pointer.h')
-rw-r--r--source/core/smart-pointer.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/core/smart-pointer.h b/source/core/smart-pointer.h
index 4c6744d1b..f45618050 100644
--- a/source/core/smart-pointer.h
+++ b/source/core/smart-pointer.h
@@ -199,6 +199,13 @@ namespace Slang
return pointer;
}
+ void attach(T* p)
+ {
+ T* old = pointer;
+ pointer = p;
+ releaseReference(old);
+ }
+
T* detach()
{
auto rs = pointer;