C++ Actor Framework 0.19
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Related Symbols | 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
 Type alias for T.
 
using value_type = T
 

Public Member Functions

 optional (const none_t &=none)
 Creates an instance without value.
 
template<class U , class E = std::enable_if_t<std::is_convertible_v<U, T>>>
 optional (U x)
 Creates an valid instance from value.
 
 optional (const optional &other)
 
 optional (optional &&other) noexcept(std::is_nothrow_move_constructible_v< T >)
 
optionaloperator= (const optional &other)
 
optionaloperator= (optional &&other) noexcept(std::is_nothrow_destructible_v< T > &&std::is_nothrow_move_assignable_v< T >)
 
 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.
 
void reset ()
 
template<class... Ts>
T & emplace (Ts &&... xs)
 

Related Symbols

(Note that these are not member symbols.)

template<class T >
auto to_string (const optional< T > &x) -> decltype(to_string(std::declval< const T & >()))
 
template<class T >
T && move_if_optional (optional< T > &x)
 Returns an rvalue to the value managed by x.
 
template<class T >
T & move_if_optional (T *x)
 Returns *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.


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