TValueOrError

Type used to return either a value or an error.

Windows
MacOS
Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Math/UnitConversion.inl

Include

#include "Math/UnitConversion.inl"

Syntax

template<typename ValueType, typename ErrorType>
class TValueOrError

Remarks

Type used to return either a value or an error.

These must have a value or an error when newly constructed, but it is possible to have neither because of the functions to steal the value or error. This is critical for callers to consider since it means that HasValue() and HasError() must be checked independently; a return value of false from one does not imply that the other will return true.

The MakeValue and MakeError functions may be used to construct these conveniently.

Constructors

Name Description

Public function

TValueOrError

(
    TValueOrError_ValueProxy< ArgTypes....
)

Construct the value from a proxy from MakeValue.

Public function

TValueOrError

(
    TValueOrError_ErrorProxy< ArgTypes....
)

Construct the error from a proxy from MakeError.

Functions

Name Description

Public function

ErrorType

 

GetError()

Public function Const

const ErrorT...

 

GetError()

Public function

ErrorType &

 

GetError()

Access the error. Asserts if this does not have an error.

Public function

ValueType &

 

GetValue()

Access the value. Asserts if this does not have a value.

Public function

ValueType

 

GetValue()

Public function Const

const ValueT...

 

GetValue()

Public function Const

bool

 

HasError()

Whether the error is set.

Public function Const

bool

 

HasValue()

Whether the value is set.

Public function Const

bool

 

IsValid()

Check whether a value is set.

Public function

ErrorType

 

StealError()

Steal the error. Asserts if this does not have an error. This causes the error to be unset.

Public function

ValueType

 

StealValue()

Steal the value. Asserts if this does not have a value. This causes the value to be unset.

Public function

ErrorType &#...

 

TryGetError()

Access the error if it is set.

Public function Const

const ErrorT...

 

TryGetError()

Public function

ValueType &#...

 

TryGetValue()

Access the value if it is set.

Public function Const

const ValueT...

 

TryGetValue()

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