TSharedRef::IsUnique

Returns true if this is the only shared reference to this object.

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Templates/SharedPointer.h

Include

#include "Templates/SharedPointer.h"

Syntax

bool IsUnique() const

Remarks

Returns true if this is the only shared reference to this object. Note that there may be outstanding weak references left.

IMPORTANT: This has different behavior to GetSharedReferenceCount() == 1 in a multithreaded context. The expectation is that this will be used when a user wants exclusive write-access to an otherwise-immutable object. Care still needs to be taken when pinning TWeakPtrs to make new shared references.

Returns

True if there is only one shared reference to the object, and this is it!

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Cancel