libcaf  0.15.3
Public Types | Public Member Functions | Related Functions | List of all members
caf::optional< T > Class Template Reference

A C++17 compatible optional implementation. More...

#include <optional.hpp>

Public Types

using type = T
 Typdef for T.
 

Public Member Functions

 optional (const none_t &=none)
 Creates an instance without value.
 
template<class U , class E = typename std::enable_if< std::is_convertible<U, T>::value >::type>
 optional (U x)
 Creates an valid instance from value.
 
 optional (const optional &other)
 
 optional (optional &&other) noexcept(std::is_nothrow_move_constructible< T >::value)
 
optionaloperator= (const optional &other)
 
optionaloperator= (optional &&other) noexcept(std::is_nothrow_destructible< T >::value && std::is_nothrow_move_assignable< T >::value)
 
 operator bool () const
 Checks whether this object contains a value.
 
bool operator! () const
 Checks whether this object does not contain a value.
 
T & operator* ()
 Returns the value.
 
const T & operator* () const
 Returns the value.
 
const T * operator-> () const
 Returns the value.
 
T * operator-> ()
 Returns the value.
 
T & value ()
 Returns the value.
 
const T & value () const
 Returns the value.
 
const T & value_or (const T &default_value) const
 Returns the value if m_valid, otherwise returns default_value.
 

Related Functions

(Note that these are not member functions.)

template<class T >
auto to_string (const optional< T > &x) -> decltype(to_string(*x))
 
template<class T >
bool operator== (const optional< T > &lhs, const optional< T > &rhs)
 
template<class T >
bool operator!= (const optional< T > &lhs, const optional< T > &rhs)
 
template<class T >
bool operator< (const optional< T > &lhs, const optional< T > &rhs)
 
template<class T >
bool operator<= (const optional< T > &lhs, const optional< T > &rhs)
 
template<class T >
bool operator>= (const optional< T > &lhs, const optional< T > &rhs)
 
template<class T >
bool operator> (const optional< T > &lhs, const optional< T > &rhs)
 
template<class T >
bool operator== (const optional< T > &lhs, none_t)
 
template<class T >
bool operator== (none_t, const optional< T > &rhs)
 
template<class T >
bool operator!= (const optional< T > &lhs, none_t)
 
template<class T >
bool operator!= (none_t, const optional< T > &rhs)
 
template<class T >
bool operator< (const optional< T > &, none_t)
 
template<class T >
bool operator< (none_t, const optional< T > &rhs)
 
template<class T >
bool operator<= (const optional< T > &lhs, none_t)
 
template<class T >
bool operator<= (none_t, const optional< T > &)
 
template<class T >
bool operator> (const optional< T > &lhs, none_t)
 
template<class T >
bool operator> (none_t, const optional< T > &)
 
template<class T >
bool operator>= (const optional< T > &, none_t)
 
template<class T >
bool operator>= (none_t, const optional< T > &)
 
template<class T >
bool operator== (const optional< T > &lhs, const T &rhs)
 
template<class T >
bool operator== (const T &lhs, const optional< T > &rhs)
 
template<class T >
bool operator!= (const optional< T > &lhs, const T &rhs)
 
template<class T >
bool operator!= (const T &lhs, const optional< T > &rhs)
 
template<class T >
bool operator< (const optional< T > &lhs, const T &rhs)
 
template<class T >
bool operator< (const T &lhs, const optional< T > &rhs)
 
template<class T >
bool operator<= (const optional< T > &lhs, const T &rhs)
 
template<class T >
bool operator<= (const T &lhs, const optional< T > &rhs)
 
template<class T >
bool operator> (const optional< T > &lhs, const T &rhs)
 
template<class T >
bool operator> (const T &lhs, const optional< T > &rhs)
 
template<class T >
bool operator>= (const optional< T > &lhs, const T &rhs)
 
template<class T >
bool operator>= (const T &lhs, const optional< T > &rhs)
 

Detailed Description

template<class T>
class caf::optional< T >

A C++17 compatible optional implementation.

Friends And Related Function Documentation

template<class T >
bool operator!= ( const optional< T > &  lhs,
const optional< T > &  rhs 
)
related
template<class T >
bool operator!= ( const optional< T > &  lhs,
none_t   
)
related
template<class T >
bool operator!= ( none_t  ,
const optional< T > &  rhs 
)
related
template<class T >
bool operator!= ( const optional< T > &  lhs,
const T &  rhs 
)
related
template<class T >
bool operator!= ( const T &  lhs,
const optional< T > &  rhs 
)
related
template<class T >
bool operator< ( const optional< T > &  lhs,
const optional< T > &  rhs 
)
related
template<class T >
bool operator< ( const optional< T > &  ,
none_t   
)
related
template<class T >
bool operator< ( none_t  ,
const optional< T > &  rhs 
)
related
template<class T >
bool operator< ( const optional< T > &  lhs,
const T &  rhs 
)
related
template<class T >
bool operator< ( const T &  lhs,
const optional< T > &  rhs 
)
related
template<class T >
bool operator<= ( const optional< T > &  lhs,
const optional< T > &  rhs 
)
related
template<class T >
bool operator<= ( const optional< T > &  lhs,
none_t   
)
related
template<class T >
bool operator<= ( none_t  ,
const optional< T > &   
)
related
template<class T >
bool operator<= ( const optional< T > &  lhs,
const T &  rhs 
)
related
template<class T >
bool operator<= ( const T &  lhs,
const optional< T > &  rhs 
)
related
template<class T >
bool operator== ( const optional< T > &  lhs,
const optional< T > &  rhs 
)
related
template<class T >
bool operator== ( const optional< T > &  lhs,
none_t   
)
related
template<class T >
bool operator== ( none_t  ,
const optional< T > &  rhs 
)
related
template<class T >
bool operator== ( const optional< T > &  lhs,
const T &  rhs 
)
related
template<class T >
bool operator== ( const T &  lhs,
const optional< T > &  rhs 
)
related
template<class T >
bool operator> ( const optional< T > &  lhs,
const optional< T > &  rhs 
)
related
template<class T >
bool operator> ( const optional< T > &  lhs,
none_t   
)
related
template<class T >
bool operator> ( none_t  ,
const optional< T > &   
)
related
template<class T >
bool operator> ( const optional< T > &  lhs,
const T &  rhs 
)
related
template<class T >
bool operator> ( const T &  lhs,
const optional< T > &  rhs 
)
related
template<class T >
bool operator>= ( const optional< T > &  lhs,
const optional< T > &  rhs 
)
related
template<class T >
bool operator>= ( const optional< T > &  ,
none_t   
)
related
template<class T >
bool operator>= ( none_t  ,
const optional< T > &   
)
related
template<class T >
bool operator>= ( const optional< T > &  lhs,
const T &  rhs 
)
related
template<class T >
bool operator>= ( const T &  lhs,
const optional< T > &  rhs 
)
related
template<class T >
auto to_string ( const optional< T > &  x) -> decltype(to_string(*x))
related

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