Language:
Discover
By Skill Level
By Category

TOptional

Choose your OS:

Syntax

template<typename OptionalType>
struct TOptional

Remarks

When we have an optional value IsSet() returns true, and GetValue() is meaningful. Otherwise GetValue() is not meaningful.

Constructors

Name Description

Public function

TOptional()

Construct an OptionalType with no value; i.e. unset

Public function

TOptional

(
    const OptionalType& InValue
)

Construct an OptionaType with a valid value.

Public function

TOptional

(
    OptionalType&& InValue
)

Public function

TOptional

(
    const TOptional & InValue
)

Copy/Move construction

Public function

TOptional

(
    TOptional && InValue
)

Destructors

Name Description

Public function

~TOptional()

Functions

Name Description

Public function

void

 

Emplace

(
    ArgsType&&... Args
)

Public function

const Option...

 

Get

(
    const OptionalType& DefaultValue
)

The optional value when set; DefaultValue otherwise.

Public function

const Option...

 

GetValue()

The optional value; undefined when IsSet() returns false.

Public function

OptionalType...

 

GetValue()

Public function

bool

 

IsSet()

True when the value is meaningful; false if calling GetValue() is undefined.

Public function

void

 

Reset()

Operators

Name Description

Public function

 

operator bool()

Public function

TOptional &

 

operator=

(
    OptionalType&& InValue
)

Public function

TOptional &

 

operator=

(
    const OptionalType& InValue
)

Public function

TOptional &

 

operator=

(
    TOptional && InValue
)

Public function

TOptional &

 

operator=

(
    const TOptional & InValue
)

Public function

const Option...

 

operator->()

Public function

OptionalType...

 

operator->()

References

Module

Core

Header

Runtime/Core/Public/Misc/Optional.h