Optional< Value > Class Template Reference

(limited) std::optional replacement (until we upgrade to C++17) More...

#include <Optional.h>

Inheritance diagram for Optional< Value >:
Collaboration diagram for Optional< Value >:

Public Member Functions

constexpr Optional () noexcept
 
constexpr Optional (const Value &v)
 
constexpr operator bool () const noexcept
 
constexpr bool has_value () const noexcept
 
const Value & value () const &
 
template<class Other >
constexpr Value value_or (Other &&defaultValue) const &
 
template<class Other = Value>
Optionaloperator= (Other &&otherValue)
 

Private Attributes

Value value_
 
bool hasValue_ = false
 

Detailed Description

template<typename Value>
class Optional< Value >

Definition at line 28 of file Optional.h.

Constructor & Destructor Documentation

◆ Optional() [1/2]

template<typename Value >
constexpr Optional< Value >::Optional ( )
inlineconstexprnoexcept

Definition at line 36 of file Optional.h.

◆ Optional() [2/2]

template<typename Value >
constexpr Optional< Value >::Optional ( const Value &  v)
inlineexplicitconstexpr

Definition at line 37 of file Optional.h.

Member Function Documentation

◆ has_value()

template<typename Value >
constexpr bool Optional< Value >::has_value ( ) const
inlineconstexprnoexcept

Definition at line 40 of file Optional.h.

◆ operator bool()

template<typename Value >
constexpr Optional< Value >::operator bool ( ) const
inlineexplicitconstexprnoexcept

Definition at line 39 of file Optional.h.

◆ operator=()

template<typename Value >
template<class Other = Value>
Optional& Optional< Value >::operator= ( Other &&  otherValue)
inline

Definition at line 56 of file Optional.h.

◆ value()

template<typename Value >
const Value& Optional< Value >::value ( ) const &
inline

Definition at line 42 of file Optional.h.

Referenced by FormattedLog::dumpOptions().

◆ value_or()

template<typename Value >
template<class Other >
constexpr Value Optional< Value >::value_or ( Other &&  defaultValue) const &
inlineconstexpr

Definition at line 50 of file Optional.h.

Referenced by FormattedLog::rotate().

Member Data Documentation

◆ hasValue_

template<typename Value >
bool Optional< Value >::hasValue_ = false
private

Definition at line 65 of file Optional.h.

◆ value_

template<typename Value >
Value Optional< Value >::value_
private

Definition at line 64 of file Optional.h.


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors