Optional< Value > Class Template Reference

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

#include <forward.h>

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 &
 

Private Attributes

Value value_
 
bool hasValue_ = false
 

Detailed Description

template<typename Value>
class Optional< Value >

Definition at line 19 of file forward.h.

Constructor & Destructor Documentation

◆ Optional() [1/2]

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

Definition at line 34 of file Optional.h.

◆ Optional() [2/2]

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

Definition at line 35 of file Optional.h.

Member Function Documentation

◆ has_value()

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

Definition at line 38 of file Optional.h.

◆ operator bool()

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

Definition at line 37 of file Optional.h.

◆ value()

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

Definition at line 40 of file Optional.h.

References BadOptionalAccess::BadOptionalAccess().

◆ value_or()

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

Definition at line 48 of file Optional.h.

Member Data Documentation

◆ hasValue_

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

Definition at line 55 of file Optional.h.

◆ value_

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

Definition at line 54 of file Optional.h.


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors