Skip to content

Commit db42e71

Browse files
committed
Core/Utils: Add aliasing constructors to Trinity::unique_weak_ptr allowing linked object lifetime (for example Aura and AuraEffect)
1 parent cd6dc22 commit db42e71

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/common/Utilities/UniqueTrackablePtr.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,14 @@ class unique_weak_ptr
179179
unique_weak_ptr(unique_weak_ptr<T2>&& other) noexcept
180180
: _ptr(std::move(other)._ptr) { }
181181

182+
template <typename T2>
183+
unique_weak_ptr(unique_trackable_ptr<T2> const& aliased, T* aliasValue)
184+
: _ptr(std::shared_ptr<T>(aliased._ptr, aliasValue)) { }
185+
186+
template <typename T2>
187+
unique_weak_ptr(unique_trackable_ptr<T2>&& aliased, T* aliasValue)
188+
: _ptr(std::shared_ptr<T>(std::move(aliased)._ptr, aliasValue)) { }
189+
182190
unique_weak_ptr& operator=(unique_trackable_ptr<T> const& trackable)
183191
{
184192
_ptr = trackable._ptr;

0 commit comments

Comments
 (0)