Hyper API for C++ 0.0.18825
Hyper client library for C++ applications
Loading...
Searching...
No Matches
hyperapi::optional< T > Class Template Reference

Surrogate for C++17 std::optional More...

#include <optional.hpp>

Public Types

using value_type = T
 The value type.
 

Public Member Functions

 optional () noexcept=default
 Constructor.
 
 optional (const optional &other)
 Copy constructor.
 
 optional (optional &&other)
 Move constructor.
 
template<typename U = value_type, typename = typename std::enable_if<!std::is_same<typename std::decay<U>::type, optional<T>>::value>::type>
 optional (U &&value)
 Constructor.
 
optionaloperator= (const optional &other)
 Copy assignment.
 
optionaloperator= (optional &&other)
 Move assignment.
 
template<typename Other >
bool operator== (const optional< Other > &other) const noexcept
 Comparison.
 
template<typename Other >
bool operator!= (const optional< Other > &other) const noexcept
 Comparison.
 
 ~optional ()
 Destructor.
 
bool has_value () const noexcept
 Checks whether *this contains a value.
 
 operator bool () const noexcept
 Checks whether *this contains a value.
 
T & value () &
 Value access.
 
const T & value () const &
 Value access.
 
T && value () &&
 Value access.
 
const T && value () const &&
 Value access.
 
template<typename U >
value_or (U &&default_value) const &
 Value or default.
 
template<typename U >
value_or (U &&default_value) &&
 Value or default.
 
T * operator-> () noexcept
 Value access.
 
const T * operator-> () const noexcept
 Value access.
 
const T & operator* () const &
 Value access.
 
T & operator* () &
 Value access.
 
const T && operator* () const &&
 Value access.
 
T && operator* () &&
 Value access.
 
void reset () noexcept
 Reset.
 
void swap (optional &other)
 Swap.
 
template<typename... Args>
void emplace (Args &&... args)
 Emplace.
 

Detailed Description

template<typename T>
class hyperapi::optional< T >

Surrogate for C++17 std::optional

Definition at line 40 of file optional.hpp.

Member Typedef Documentation

◆ value_type

template<typename T >
using hyperapi::optional< T >::value_type = T

The value type.

Definition at line 50 of file optional.hpp.

Constructor & Destructor Documentation

◆ ~optional()

template<typename T >
hyperapi::optional< T >::~optional ( )
inline

Destructor.

Definition at line 84 of file optional.hpp.

Member Function Documentation

◆ has_value()

template<typename T >
bool hyperapi::optional< T >::has_value ( ) const
inlinenoexcept

Checks whether *this contains a value.

Definition at line 87 of file optional.hpp.

◆ operator bool()

template<typename T >
hyperapi::optional< T >::operator bool ( ) const
inlineexplicitnoexcept

Checks whether *this contains a value.

Definition at line 89 of file optional.hpp.

◆ operator!=()

template<typename T >
template<typename Other >
bool hyperapi::optional< T >::operator!= ( const optional< Other > &  other) const
inlinenoexcept

Comparison.

Definition at line 81 of file optional.hpp.

◆ operator*() [1/4]

template<typename T >
T & hyperapi::optional< T >::operator* ( ) &
inline

Value access.

Definition at line 140 of file optional.hpp.

◆ operator*() [2/4]

template<typename T >
T && hyperapi::optional< T >::operator* ( ) &&
inline

Value access.

Definition at line 144 of file optional.hpp.

◆ operator*() [3/4]

template<typename T >
const T & hyperapi::optional< T >::operator* ( ) const &
inline

Value access.

Definition at line 138 of file optional.hpp.

◆ operator*() [4/4]

template<typename T >
const T && hyperapi::optional< T >::operator* ( ) const &&
inline

Value access.

Definition at line 142 of file optional.hpp.

◆ operator->() [1/2]

template<typename T >
const T * hyperapi::optional< T >::operator-> ( ) const
inlinenoexcept

Value access.

Definition at line 135 of file optional.hpp.

◆ operator->() [2/2]

template<typename T >
T * hyperapi::optional< T >::operator-> ( )
inlinenoexcept

Value access.

Definition at line 133 of file optional.hpp.

◆ operator==()

template<typename T >
template<typename Other >
bool hyperapi::optional< T >::operator== ( const optional< Other > &  other) const
inlinenoexcept

Comparison.

Definition at line 76 of file optional.hpp.

◆ value() [1/4]

template<typename T >
T & hyperapi::optional< T >::value ( ) &
inline

Value access.

Definition at line 92 of file optional.hpp.

◆ value() [2/4]

template<typename T >
T && hyperapi::optional< T >::value ( ) &&
inline

Value access.

Definition at line 106 of file optional.hpp.

◆ value() [3/4]

template<typename T >
const T & hyperapi::optional< T >::value ( ) const &
inline

Value access.

Definition at line 99 of file optional.hpp.

◆ value() [4/4]

template<typename T >
const T && hyperapi::optional< T >::value ( ) const &&
inline

Value access.

Definition at line 113 of file optional.hpp.

◆ value_or() [1/2]

template<typename T >
template<typename U >
T hyperapi::optional< T >::value_or ( U &&  default_value) &&
inline

Value or default.

Definition at line 128 of file optional.hpp.

◆ value_or() [2/2]

template<typename T >
template<typename U >
T hyperapi::optional< T >::value_or ( U &&  default_value) const &
inline

Value or default.

Definition at line 122 of file optional.hpp.


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