TSharedPtr::TSharedPtr

Constructs a shared pointer that owns the specified object.

Windows
MacOS
Linux

References

Module

Core

Header

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

Include

#include "Templates/SharedPointer.h"

Syntax

template<typename OtherType, typename DeleterType, typename>
TSharedPtr
(
    OtherType * InObject,
    DeleterType && InDeleter
)

Remarks

Constructs a shared pointer that owns the specified object. Note that passing nullptr here will still create a tracked reference to a nullptr pointer. (Consistent with std::shared_ptr)

Parameters

Parameter

Description

InObject

Object this shared pointer to retain a reference to

InDeleter

Deleter object used to destroy the object when it is no longer referenced.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback