optionalData< T > Class Template Reference

A simplified version of std::optional (c++17), with much simpler construction semantics. More...

Public Member Functions

 optionalData (const optionalData< T > &)=default
 Copy construct. More...
 
 optionalData (optionalData< T > &&)=default
 Move construct. More...
 
optionalData< T > & operator= (const optionalData< T > &)=default
 Copy assignment. More...
 
optionalData< T > & operator= (optionalData< T > &&)=default
 Move assignment. More...
 
 optionalData ()
 Default construct. More...
 
 optionalData (const T &val)
 Copy construct from value. More...
 
 optionalData (T &&val)
 Move construct from value. More...
 
bool has_value () const noexcept
 True if it has a value. More...
 
Tvalue () noexcept
 Access to the value. More...
 
const Tvalue () const noexcept
 Access to the value. More...
 
const Tvalue_or (const T &deflt) const
 Return value or default. More...
 
 operator bool () const noexcept
 True if it has a value. More...
 
const Toperator* () const noexcept
 Access the value. More...
 
Toperator* () noexcept
 Access the value. More...
 
void operator= (const T &val)
 Copy assignment from value. More...
 
void operator= (T &&val)
 Move assignment from value. More...
 

Detailed Description

template<class T>
class Foam::optionalData< T >

A simplified version of std::optional (c++17), with much simpler construction semantics.

Definition at line 47 of file optionalData.H.

Constructor & Destructor Documentation

◆ optionalData() [1/5]

optionalData ( const optionalData< T > &  )
default

Copy construct.

◆ optionalData() [2/5]

optionalData ( optionalData< T > &&  )
default

Move construct.

◆ optionalData() [3/5]

optionalData ( )
inline

Default construct.

Definition at line 78 of file optionalData.H.

◆ optionalData() [4/5]

optionalData ( const T val)
inline

Copy construct from value.

Definition at line 85 of file optionalData.H.

◆ optionalData() [5/5]

optionalData ( T &&  val)
inline

Move construct from value.

Definition at line 92 of file optionalData.H.

Member Function Documentation

◆ operator=() [1/4]

optionalData<T>& operator= ( const optionalData< T > &  )
default

Copy assignment.

◆ operator=() [2/4]

optionalData<T>& operator= ( optionalData< T > &&  )
default

Move assignment.

◆ has_value()

bool has_value ( ) const
inlinenoexcept

True if it has a value.

Definition at line 102 of file optionalData.H.

◆ value() [1/2]

T& value ( )
inlinenoexcept

Access to the value.

Definition at line 108 of file optionalData.H.

◆ value() [2/2]

const T& value ( ) const
inlinenoexcept

Access to the value.

Definition at line 114 of file optionalData.H.

◆ value_or()

const T& value_or ( const T deflt) const
inline

Return value or default.

Definition at line 120 of file optionalData.H.

◆ operator bool()

operator bool ( ) const
inlineexplicitnoexcept

True if it has a value.

Definition at line 129 of file optionalData.H.

◆ operator*() [1/2]

const T& operator* ( ) const
inlinenoexcept

Access the value.

Definition at line 135 of file optionalData.H.

◆ operator*() [2/2]

T& operator* ( )
inlinenoexcept

Access the value.

Definition at line 141 of file optionalData.H.

◆ operator=() [3/4]

void operator= ( const T val)
inline

Copy assignment from value.

Definition at line 147 of file optionalData.H.

◆ operator=() [4/4]

void operator= ( T &&  val)
inline

Move assignment from value.

Definition at line 154 of file optionalData.H.


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