E-MailRelay
Public Member Functions | List of all members
G::optional< T > Class Template Reference

A class template like a simplified c++17 std::optional. More...

#include <goptional.h>

Public Member Functions

 optional () noexcept(noexcept(T()))
 Default constructor for no value.
 
 optional (const T &)
 Constructor for a defined value. More...
 
void reset ()
 Clears the value. More...
 
bool has_value () const noexcept
 Returns true if a defined value. More...
 
 operator bool () const noexcept
 Returns true if a defined value. More...
 
const T & value () const
 Returns the value. More...
 
value_or (const T &) const
 Returns the value or a default. More...
 
optional< T > & operator= (const T &)
 Assignment for a defined value. More...
 
 optional (const optional &)=default
 
 optional (optional &&) noexcept=default
 
optionaloperator= (const optional &)=default
 
optionaloperator= (optional &&) noexcept=default
 

Detailed Description

template<typename T>
class G::optional< T >

A class template like a simplified c++17 std::optional.

Definition at line 49 of file goptional.h.

Constructor & Destructor Documentation

◆ optional()

template<typename T >
G::optional< T >::optional ( const T &  t)
explicit

Constructor for a defined value.

Definition at line 96 of file goptional.h.

Member Function Documentation

◆ has_value()

template<typename T >
bool G::optional< T >::has_value
noexcept

Returns true if a defined value.

Definition at line 109 of file goptional.h.

◆ operator bool()

template<typename T >
G::optional< T >::operator bool
explicitnoexcept

Returns true if a defined value.

Definition at line 115 of file goptional.h.

◆ operator=()

template<typename T >
G::optional< T > & G::optional< T >::operator= ( const T &  t)

Assignment for a defined value.

Definition at line 140 of file goptional.h.

◆ reset()

template<typename T >
void G::optional< T >::reset

Clears the value.

Definition at line 103 of file goptional.h.

◆ value()

template<typename T >
const T & G::optional< T >::value

Returns the value.

Definition at line 121 of file goptional.h.

◆ value_or()

template<typename T >
T G::optional< T >::value_or ( const T &  default_) const

Returns the value or a default.

Definition at line 134 of file goptional.h.


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