WRApplication
External kratos "application" for multiscale time integration.
OptionalRef< TElement > Class Template Reference

An optional, modeling a pointer. More...

Collaboration diagram for OptionalRef< TElement >:

Public Types

using value_type = TElement &
 

Public Member Functions

 OptionalRef () noexcept
 Construct an invalid (uninitialized) optional. More...
 
 OptionalRef (TElement &rElement) noexcept
 Construct an optional reference to the provided instance. More...
 
 OptionalRef (OptionalRef &&rRhs) noexcept=default
 
 OptionalRef (const OptionalRef &rRhs) noexcept=default
 
OptionalRefoperator= (OptionalRef &&rRhs) noexcept=default
 
OptionalRefoperator= (const OptionalRef &rRhs) noexcept=default
 
OptionalRefoperator= (TElement &rElement) noexcept
 Assign the provided instance to the optional. More...
 
bool has_value () const noexcept
 Check whether the optional is valid. More...
 
 operator bool () const noexcept
 Check whether the optional is valid. More...
 
TElement & value () const
 Access the stored reference. More...
 
TElement & operator* () const noexcept
 Access the stored reference. More...
 
void reset () noexcept
 Clear the optional. More...
 

Detailed Description

template<class TElement>
class Kratos::WRApp::OptionalRef< TElement >

An optional, modeling a pointer.

OptionalRef stores a pointer to the instance it was assigned and stores the value indicator in the least significant bit of the pointer. As a result, the memory alignment of OptionalRef is identical to that of the stored pointer.

Member Typedef Documentation

◆ value_type

using value_type = TElement&

Constructor & Destructor Documentation

◆ OptionalRef() [1/4]

OptionalRef ( )
inlinenoexcept

Construct an invalid (uninitialized) optional.

◆ OptionalRef() [2/4]

OptionalRef ( TElement &  rElement)
inlineexplicitnoexcept

Construct an optional reference to the provided instance.

◆ OptionalRef() [3/4]

OptionalRef ( OptionalRef< TElement > &&  rRhs)
defaultnoexcept

◆ OptionalRef() [4/4]

OptionalRef ( const OptionalRef< TElement > &  rRhs)
defaultnoexcept

Member Function Documentation

◆ has_value()

bool has_value ( ) const
inlinenoexcept

Check whether the optional is valid.

◆ operator bool()

operator bool ( ) const
inlineexplicitnoexcept

Check whether the optional is valid.

◆ operator*()

TElement& operator* ( ) const
inlinenoexcept

Access the stored reference.

Exceptions
ifthe optional is uninitialized.

◆ operator=() [1/3]

OptionalRef& operator= ( const OptionalRef< TElement > &  rRhs)
defaultnoexcept

◆ operator=() [2/3]

OptionalRef& operator= ( OptionalRef< TElement > &&  rRhs)
defaultnoexcept

◆ operator=() [3/3]

OptionalRef& operator= ( TElement &  rElement)
inlinenoexcept

Assign the provided instance to the optional.

◆ reset()

void reset ( )
inlinenoexcept

Clear the optional.

◆ value()

TElement& value ( ) const
inline

Access the stored reference.

Exceptions
ifthe optional is uninitialized.

Member Data Documentation

◆ integer

PointerInteger integer

◆ pointer

TElement* pointer

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