UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TValueOrError< ValueType, ErrorType > Class Template Reference

#include <ValueOrError.h>

Public Member Functions

template<typename... ArgTypes>
 TValueOrError (TValueOrError_ValueProxy< ArgTypes... > &&Proxy)
 
template<typename... ArgTypes>
 TValueOrError (TValueOrError_ErrorProxy< ArgTypes... > &&Proxy)
 
UE_REWRITE bool IsValid () const
 
UE_REWRITE bool HasError () const
 
ErrorType & GetError () &UE_LIFETIMEBOUND
 
UE_REWRITE const ErrorType & GetError () const &UE_LIFETIMEBOUND
 
UE_REWRITE ErrorType && GetError () &&UE_LIFETIMEBOUND
 
ErrorType * TryGetError () UE_LIFETIMEBOUND
 
UE_REWRITE const ErrorType * TryGetError () const UE_LIFETIMEBOUND
 
ErrorType StealError ()
 
UE_REWRITE bool HasValue () const
 
ValueType & GetValue () &UE_LIFETIMEBOUND
 
UE_REWRITE const ValueType & GetValue () const &UE_LIFETIMEBOUND
 
UE_REWRITE ValueType && GetValue () &&UE_LIFETIMEBOUND
 
UE_REWRITE ValueType * TryGetValue () UE_LIFETIMEBOUND
 
UE_REWRITE const ValueType * TryGetValue () const UE_LIFETIMEBOUND
 
ValueType StealValue ()
 

Detailed Description

template<typename ValueType, typename ErrorType>
class TValueOrError< ValueType, ErrorType >

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.

Constructor & Destructor Documentation

◆ TValueOrError() [1/2]

template<typename ValueType , typename ErrorType >
template<typename... ArgTypes>
TValueOrError< ValueType, ErrorType >::TValueOrError ( TValueOrError_ValueProxy< ArgTypes... > &&  Proxy)
inline

Construct the value from a proxy from MakeValue.

◆ TValueOrError() [2/2]

template<typename ValueType , typename ErrorType >
template<typename... ArgTypes>
TValueOrError< ValueType, ErrorType >::TValueOrError ( TValueOrError_ErrorProxy< ArgTypes... > &&  Proxy)
inline

Construct the error from a proxy from MakeError.

Member Function Documentation

◆ GetError() [1/3]

template<typename ValueType , typename ErrorType >
UE_REWRITE ErrorType && TValueOrError< ValueType, ErrorType >::GetError ( ) &&
inline

◆ GetError() [2/3]

template<typename ValueType , typename ErrorType >
ErrorType & TValueOrError< ValueType, ErrorType >::GetError ( ) &
inline

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

◆ GetError() [3/3]

template<typename ValueType , typename ErrorType >
UE_REWRITE const ErrorType & TValueOrError< ValueType, ErrorType >::GetError ( ) const &
inline

◆ GetValue() [1/3]

template<typename ValueType , typename ErrorType >
UE_REWRITE ValueType && TValueOrError< ValueType, ErrorType >::GetValue ( ) &&
inline

◆ GetValue() [2/3]

template<typename ValueType , typename ErrorType >
ValueType & TValueOrError< ValueType, ErrorType >::GetValue ( ) &
inline

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

◆ GetValue() [3/3]

template<typename ValueType , typename ErrorType >
UE_REWRITE const ValueType & TValueOrError< ValueType, ErrorType >::GetValue ( ) const &
inline

◆ HasError()

template<typename ValueType , typename ErrorType >
UE_REWRITE bool TValueOrError< ValueType, ErrorType >::HasError ( ) const
inline

Whether the error is set. An error does imply no value. No error does not imply that a value is set.

◆ HasValue()

template<typename ValueType , typename ErrorType >
UE_REWRITE bool TValueOrError< ValueType, ErrorType >::HasValue ( ) const
inline

Whether the value is set. A value does imply no error. No value does not imply that an error is set.

◆ IsValid()

template<typename ValueType , typename ErrorType >
UE_REWRITE bool TValueOrError< ValueType, ErrorType >::IsValid ( ) const
inline

Check whether a value is set. Prefer HasValue and HasError to this. !IsValid() does not imply HasError().

◆ StealError()

template<typename ValueType , typename ErrorType >
ErrorType TValueOrError< ValueType, ErrorType >::StealError ( )
inline

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

◆ StealValue()

template<typename ValueType , typename ErrorType >
ValueType TValueOrError< ValueType, ErrorType >::StealValue ( )
inline

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

◆ TryGetError() [1/2]

template<typename ValueType , typename ErrorType >
UE_REWRITE const ErrorType * TValueOrError< ValueType, ErrorType >::TryGetError ( ) const
inline

◆ TryGetError() [2/2]

template<typename ValueType , typename ErrorType >
ErrorType * TValueOrError< ValueType, ErrorType >::TryGetError ( )
inline

Access the error if it is set.

◆ TryGetValue() [1/2]

template<typename ValueType , typename ErrorType >
UE_REWRITE const ValueType * TValueOrError< ValueType, ErrorType >::TryGetValue ( ) const
inline

◆ TryGetValue() [2/2]

template<typename ValueType , typename ErrorType >
UE_REWRITE ValueType * TValueOrError< ValueType, ErrorType >::TryGetValue ( )
inline

Access the value if it is set.


The documentation for this class was generated from the following files: