MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
cpptoml::option< T > Class Template Reference

#include <cpptoml.h>

Public Member Functions

 option ()
 
 option (T value)
 
 operator MBool () const
 
const T & operator* () const
 
const T * operator-> () const
 
const T & value_or (const T &alternative) const
 

Private Attributes

MBool empty_
 
value_
 

Detailed Description

template<class T>
class cpptoml::option< T >

Definition at line 106 of file cpptoml.h.

Constructor & Destructor Documentation

◆ option() [1/2]

template<class T >
cpptoml::option< T >::option ( )
inline

Definition at line 108 of file cpptoml.h.

108 : empty_{true} {
109 // nothing
110 }
MBool empty_
Definition: cpptoml.h:128

◆ option() [2/2]

template<class T >
cpptoml::option< T >::option ( value)
inline

Definition at line 112 of file cpptoml.h.

112 : empty_{false}, value_(std::move(value)) {
113 // nothing
114 }

Member Function Documentation

◆ operator MBool()

template<class T >
cpptoml::option< T >::operator MBool ( ) const
inlineexplicit

Definition at line 116 of file cpptoml.h.

116{ return !empty_; }

◆ operator*()

template<class T >
const T & cpptoml::option< T >::operator* ( ) const
inline

Definition at line 118 of file cpptoml.h.

118{ return value_; }

◆ operator->()

template<class T >
const T * cpptoml::option< T >::operator-> ( ) const
inline

Definition at line 120 of file cpptoml.h.

120{ return &value_; }

◆ value_or()

template<class T >
const T & cpptoml::option< T >::value_or ( const T &  alternative) const
inline

Definition at line 122 of file cpptoml.h.

122 {
123 if(!empty_) return value_;
124 return alternative;
125 }

Member Data Documentation

◆ empty_

template<class T >
MBool cpptoml::option< T >::empty_
private

Definition at line 128 of file cpptoml.h.

◆ value_

template<class T >
T cpptoml::option< T >::value_
private

Definition at line 129 of file cpptoml.h.


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