MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
Mcro::UObjects::Init::TScopeObject< T > Struct Template Reference

A struct to emulate regular C++ RAII object behavior with UObjects. When this struct is instantiated the given object type is also created. An object wrapped in this struct is never invalid, and doesn't get garbage collected until it's in scope. More...

#include <ScopeObject.h>

Public Member Functions

template<typename... Args>
 TScopeObject (FConstructObjectParameters &&params, Args &&... args)
 
const T * operator-> () const
 
T * operator-> ()
 
 operator const T * () const
 
 operator T* ()
 
T const & Get () const
 
T & Get ()
 

Detailed Description

template<CUObject T>
struct Mcro::UObjects::Init::TScopeObject< T >

A struct to emulate regular C++ RAII object behavior with UObjects. When this struct is instantiated the given object type is also created. An object wrapped in this struct is never invalid, and doesn't get garbage collected until it's in scope.

It is safe to create this struct on any thread, GC is deferred until constructor is finished. The underlying storage is a TStrongObjectPtr.

If the given object type happen to have an Intialize member method, that's also called with the extra arguments provided in the constructor.

Definition at line 33 of file ScopeObject.h.

Constructor & Destructor Documentation

◆ TScopeObject()

template<CUObject T>
template<typename... Args>
Mcro::UObjects::Init::TScopeObject< T >::TScopeObject ( FConstructObjectParameters && params,
Args &&... args )
inline

Definition at line 36 of file ScopeObject.h.

Member Function Documentation

◆ Get() [1/2]

template<CUObject T>
T & Mcro::UObjects::Init::TScopeObject< T >::Get ( )
inline

Definition at line 49 of file ScopeObject.h.

◆ Get() [2/2]

template<CUObject T>
T const & Mcro::UObjects::Init::TScopeObject< T >::Get ( ) const
inline

Definition at line 48 of file ScopeObject.h.

◆ operator const T *()

template<CUObject T>
Mcro::UObjects::Init::TScopeObject< T >::operator const T * ( ) const
inline

Definition at line 45 of file ScopeObject.h.

◆ operator T*()

template<CUObject T>
Mcro::UObjects::Init::TScopeObject< T >::operator T* ( )
inline

Definition at line 46 of file ScopeObject.h.

◆ operator->() [1/2]

template<CUObject T>
T * Mcro::UObjects::Init::TScopeObject< T >::operator-> ( )
inline

Definition at line 43 of file ScopeObject.h.

◆ operator->() [2/2]

template<CUObject T>
const T * Mcro::UObjects::Init::TScopeObject< T >::operator-> ( ) const
inline

Definition at line 42 of file ScopeObject.h.


The documentation for this struct was generated from the following file: