dune-common  2.7.1
Public Types | Public Member Functions | List of all members
Dune::Std::optional< T > Class Template Reference

#include <dune/common/std/optional.hh>

Inheritance diagram for Dune::Std::optional< T >:
Inheritance graph

Public Types

typedef T value_type
 type of value More...
 

Public Member Functions

 ~optional ()
 
Construction
constexpr optional () noexcept
 
constexpr optional (nullopt_t) noexcept
 
template<class U = value_type, std::enable_if_t< std::is_constructible< value_type, U && >::value, int > = 0, std::enable_if_t< !std::is_convertible< U &&, value_type >::value, int > = 0>
constexpr optional (U &&value)
 
template<class U = value_type, std::enable_if_t< std::is_constructible< value_type, U && >::value, int > = 0, std::enable_if_t< not(std::is_same< std::decay_t< U >, optional< value_type >>::value), int > = 0, std::enable_if_t< not(std::is_same< std::decay_t< U >, in_place_t >::value), int > = 0>
constexpr optional (U &&value)
 
 optional (const value_type &value)
 
 optional (value_type &&value)
 
template<class... Args>
constexpr optional (in_place_t, Args &&... args)
 
Copying and Assignment
 optional (const optional &other) noexcept(std::is_nothrow_copy_constructible< T >::value)
 
 optional (optional &&other) noexcept(std::is_nothrow_move_constructible< T >::value)
 
template<class U , std::enable_if_t< std::is_constructible< value_type, const U & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, const optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > && >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< const optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &&, value_type >::value, int > = 0, std::enable_if_t< !std::is_convertible< const U &, value_type >::value, int > = 0>
 optional (const optional< U > &other)
 
template<class U , std::enable_if_t< std::is_constructible< value_type, const U & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, const optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > && >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< const optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &&, value_type >::value, int > = 0, std::enable_if_t< std::is_convertible< const U &, value_type >::value, int > = 0>
 optional (const optional< U > &other)
 
template<class U , std::enable_if_t< std::is_constructible< value_type, const U & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, const optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > && >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< const optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &&, value_type >::value, int > = 0, std::enable_if_t< !std::is_convertible< const U &, value_type >::value, int > = 0>
 optional (optional< U > &&other)
 
template<class U , std::enable_if_t< std::is_constructible< value_type, const U & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, const optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > && >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< const optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &&, value_type >::value, int > = 0, std::enable_if_t< std::is_convertible< const U &, value_type >::value, int > = 0>
 optional (optional< U > &&other)
 
optionaloperator= (nullopt_t) noexcept
 
optionaloperator= (const optional &other) noexcept(std::is_nothrow_copy_constructible< T >::value &&std::is_nothrow_copy_assignable< T >::value)
 
optionaloperator= (optional &&other) noexcept(std::is_nothrow_move_constructible< T >::value &&std::is_nothrow_move_assignable< T >::value)
 
template<class U = value_type>
std::enable_if< std::is_constructible< value_type, U >::value &&std::is_assignable< value_type, U >::value, optional & >::type operator= (U &&value)
 
Observers
constexpr operator bool () const noexcept
 return true if optional is engaged, false otherwise More...
 
const value_typeoperator* () const noexcept
 dereference pointer More...
 
value_typeoperator* () noexcept
 dereference pointer More...
 
const value_typeoperator-> () const noexcept
 pointer operator More...
 
value_typeoperator-> () noexcept
 pointer operator More...
 
const value_typevalue () const
 
value_typevalue ()
 
template<class U >
value_type value_or (U &&value) const
 
Modifiers
template<class... Args>
void emplace (Args &&... args)
 
void reset () noexcept
 
void swap (optional &other) noexcept(std::is_nothrow_move_constructible< T >::value &&noexcept(std::swap(std::declval< T & >(), std::declval< T & >())))
 

Member Typedef Documentation

◆ value_type

template<class T >
typedef T Dune::Std::optional< T >::value_type

type of value

Constructor & Destructor Documentation

◆ optional() [1/13]

template<class T >
constexpr Dune::Std::optional< T >::optional ( )
inlineconstexprnoexcept

◆ optional() [2/13]

template<class T >
constexpr Dune::Std::optional< T >::optional ( nullopt_t  )
inlineconstexprnoexcept

◆ optional() [3/13]

template<class T >
template<class U = value_type, std::enable_if_t< std::is_constructible< value_type, U && >::value, int > = 0, std::enable_if_t< !std::is_convertible< U &&, value_type >::value, int > = 0>
constexpr Dune::Std::optional< T >::optional ( U &&  value)
inlineexplicitconstexpr

◆ optional() [4/13]

template<class T >
template<class U = value_type, std::enable_if_t< std::is_constructible< value_type, U && >::value, int > = 0, std::enable_if_t< not(std::is_same< std::decay_t< U >, optional< value_type >>::value), int > = 0, std::enable_if_t< not(std::is_same< std::decay_t< U >, in_place_t >::value), int > = 0>
constexpr Dune::Std::optional< T >::optional ( U &&  value)
inlineconstexpr

◆ optional() [5/13]

template<class T >
Dune::Std::optional< T >::optional ( const value_type value)
inline

◆ optional() [6/13]

template<class T >
Dune::Std::optional< T >::optional ( value_type &&  value)
inline

◆ optional() [7/13]

template<class T >
template<class... Args>
constexpr Dune::Std::optional< T >::optional ( in_place_t  ,
Args &&...  args 
)
inlineexplicitconstexpr

◆ optional() [8/13]

template<class T >
Dune::Std::optional< T >::optional ( const optional< T > &  other)
inlinenoexcept

◆ optional() [9/13]

template<class T >
Dune::Std::optional< T >::optional ( optional< T > &&  other)
inlinenoexcept

◆ optional() [10/13]

template<class T >
template<class U , std::enable_if_t< std::is_constructible< value_type, const U & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, const optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > && >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< const optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &&, value_type >::value, int > = 0, std::enable_if_t< !std::is_convertible< const U &, value_type >::value, int > = 0>
Dune::Std::optional< T >::optional ( const optional< U > &  other)
inlineexplicit

◆ optional() [11/13]

template<class T >
template<class U , std::enable_if_t< std::is_constructible< value_type, const U & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, const optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > && >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< const optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &&, value_type >::value, int > = 0, std::enable_if_t< std::is_convertible< const U &, value_type >::value, int > = 0>
Dune::Std::optional< T >::optional ( const optional< U > &  other)
inline

◆ optional() [12/13]

template<class T >
template<class U , std::enable_if_t< std::is_constructible< value_type, const U & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, const optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > && >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< const optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &&, value_type >::value, int > = 0, std::enable_if_t< !std::is_convertible< const U &, value_type >::value, int > = 0>
Dune::Std::optional< T >::optional ( optional< U > &&  other)
inlineexplicit

◆ optional() [13/13]

template<class T >
template<class U , std::enable_if_t< std::is_constructible< value_type, const U & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, const optional< U > & >::value, int > = 0, std::enable_if_t< !std::is_constructible< value_type, optional< U > && >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< const optional< U > &, value_type >::value, int > = 0, std::enable_if_t< !std::is_constructible< optional< U > &&, value_type >::value, int > = 0, std::enable_if_t< std::is_convertible< const U &, value_type >::value, int > = 0>
Dune::Std::optional< T >::optional ( optional< U > &&  other)
inline

◆ ~optional()

template<class T >
Dune::Std::optional< T >::~optional ( )
inline

Member Function Documentation

◆ emplace()

template<class T >
template<class... Args>
void Dune::Std::optional< T >::emplace ( Args &&...  args)
inline

◆ operator bool()

template<class T >
constexpr Dune::Std::optional< T >::operator bool ( ) const
inlineexplicitconstexprnoexcept

return true if optional is engaged, false otherwise

◆ operator*() [1/2]

template<class T >
const value_type& Dune::Std::optional< T >::operator* ( ) const
inlinenoexcept

dereference pointer

◆ operator*() [2/2]

template<class T >
value_type& Dune::Std::optional< T >::operator* ( )
inlinenoexcept

dereference pointer

◆ operator->() [1/2]

template<class T >
const value_type* Dune::Std::optional< T >::operator-> ( ) const
inlinenoexcept

pointer operator

◆ operator->() [2/2]

template<class T >
value_type* Dune::Std::optional< T >::operator-> ( )
inlinenoexcept

pointer operator

◆ operator=() [1/4]

template<class T >
optional& Dune::Std::optional< T >::operator= ( const optional< T > &  other)
inlinenoexcept

◆ operator=() [2/4]

template<class T >
optional& Dune::Std::optional< T >::operator= ( nullopt_t  )
inlinenoexcept

◆ operator=() [3/4]

template<class T >
optional& Dune::Std::optional< T >::operator= ( optional< T > &&  other)
inlinenoexcept

◆ operator=() [4/4]

template<class T >
template<class U = value_type>
std::enable_if< std::is_constructible< value_type, U >::value && std::is_assignable< value_type, U >::value, optional & >::type Dune::Std::optional< T >::operator= ( U &&  value)
inline

◆ reset()

template<class T >
void Dune::Std::optional< T >::reset ( )
inlinenoexcept

◆ swap()

template<class T >
void Dune::Std::optional< T >::swap ( optional< T > &  other)
inlinenoexcept

◆ value() [1/2]

template<class T >
value_type& Dune::Std::optional< T >::value ( )
inline

◆ value() [2/2]

template<class T >
const value_type& Dune::Std::optional< T >::value ( ) const
inline

◆ value_or()

template<class T >
template<class U >
value_type Dune::Std::optional< T >::value_or ( U &&  value) const
inline

Member Data Documentation

◆ value_

template<class T >
value_type Dune::Std::optional< T >::value_

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