Agora C++ API Reference for All Platforms
agora::Optional< T > Class Template Reference

#include <AgoraOptional.h>

Inherits agora::internal::OptionalBase< T >, agora::internal::CopyConstructible< std::is_copy_constructible< T >::value >, agora::internal::MoveConstructible< std::is_move_constructible< T >::value >, agora::internal::CopyAssignable< std::is_copy_constructible< T >::value &&std::is_copy_assignable< T >::value >, and agora::internal::MoveAssignable< std::is_move_constructible< T >::value &&std::is_move_assignable< T >::value >.

Public Types

typedef T value_type
 

Public Member Functions

CONSTEXPR Optional ()
 
CONSTEXPR Optional (const Optional &other)
 
CONSTEXPR Optional (nullopt_t)
 
template<typename U >
 Optional (const Optional< U > &other)
 
template<typename U >
 Optional (Optional< U > &&other)
 
template<class... Args>
CONSTEXPR Optional (in_place_t, Args &&... args)
 
template<class U , class... Args>
CONSTEXPR Optional (in_place_t, std::initializer_list< U > il, Args &&... args)
 
CONSTEXPR Optional (in_place_t, const T &_value)
 
template<class U >
CONSTEXPR Optional (in_place_t, const U il[], const T &_value)
 
template<typename U = value_type>
CONSTEXPR Optional (U &&value)
 
template<typename U >
CONSTEXPR Optional (const U &value)
 
 ~Optional ()
 
Optionaloperator= (const Optional &other)
 
Optionaloperator= (nullopt_t)
 
template<typename U >
Optionaloperator= (U &&value)
 
Optionaloperator= (const U &value)
 
template<typename U >
Optionaloperator= (const Optional< U > &other)
 
template<typename U >
Optionaloperator= (Optional< U > &&other)
 
const T * operator-> () const
 
T * operator-> ()
 
const T & operator* () const
 
T & operator* ()
 
CONSTEXPR operator bool () const
 
CONSTEXPR operator bool () const
 
CONSTEXPR bool has_value () const
 
const T & value () const
 
template<class U >
CONSTEXPR T value_or (U &&default_value) const
 
CONSTEXPR T value_or (const U &default_value) const
 
const T & value () const &
 
const T && value () const &&
 
template<class U >
CONSTEXPR T value_or (U &&default_value) const &
 
CONSTEXPR T value_or (const U &default_value) const &
 
template<class U >
CONSTEXPR T value_or (U &&default_value) const &&
 
void swap (Optional &other)
 
void reset ()
 
template<class... Args>
T & emplace (Args &&... args)
 
template<class U , class... Args>
T & emplace (std::initializer_list< U > il, Args &&... args)
 
T & emplace (const T &_value)
 
template<class U >
T & emplace (const U il[], const T &_value)
 

Additional Inherited Members

- Protected Member Functions inherited from agora::internal::OptionalBase< T >
CONSTEXPR OptionalBase ()
 
CONSTEXPR OptionalBase (const OptionalBase &other)
 
CONSTEXPR OptionalBase (OptionalBase &&other)
 
template<class... Args>
CONSTEXPR OptionalBase (in_place_t, Args &&... args)
 
CONSTEXPR OptionalBase (in_place_t, const T &_value)
 
template<typename U >
 OptionalBase (const OptionalBase< U > &other)
 
template<typename U >
 OptionalBase (OptionalBase< U > &&other)
 
 ~OptionalBase ()
 
OptionalBaseoperator= (const OptionalBase &other)
 
OptionalBaseoperator= (OptionalBase &&other) NOEXCEPT(std
 
template<typename U >
void CopyAssign (const OptionalBase< U > &other)
 
template<typename U >
void MoveAssign (OptionalBase< U > &&other)
 
template<typename U >
void InitOrAssign (U &&value)
 
void InitOrAssign (const U &value)
 
void FreeIfNeeded ()
 
- Protected Attributes inherited from agora::internal::OptionalBase< T >
OptionalStorage< T > storage_
 

Member Typedef Documentation

◆ value_type

template<typename T >
typedef T agora::Optional< T >::value_type

Constructor & Destructor Documentation

◆ Optional() [1/11]

template<typename T >
CONSTEXPR agora::Optional< T >::Optional ( )
inline

◆ Optional() [2/11]

template<typename T >
CONSTEXPR agora::Optional< T >::Optional ( const Optional< T > &  other)
inline

◆ Optional() [3/11]

template<typename T >
CONSTEXPR agora::Optional< T >::Optional ( nullopt_t  )
inline

◆ Optional() [4/11]

template<typename T >
template<typename U >
agora::Optional< T >::Optional ( const Optional< U > &  other)
inline

◆ Optional() [5/11]

template<typename T >
template<typename U >
agora::Optional< T >::Optional ( Optional< U > &&  other)
inline

◆ Optional() [6/11]

template<typename T >
template<class... Args>
CONSTEXPR agora::Optional< T >::Optional ( in_place_t  ,
Args &&...  args 
)
inlineexplicit

◆ Optional() [7/11]

template<typename T >
template<class U , class... Args>
CONSTEXPR agora::Optional< T >::Optional ( in_place_t  ,
std::initializer_list< U >  il,
Args &&...  args 
)
inlineexplicit

◆ Optional() [8/11]

template<typename T >
CONSTEXPR agora::Optional< T >::Optional ( in_place_t  ,
const T &  _value 
)
inlineexplicit

◆ Optional() [9/11]

template<typename T >
template<class U >
CONSTEXPR agora::Optional< T >::Optional ( in_place_t  ,
const U  il[],
const T &  _value 
)
inlineexplicit

◆ Optional() [10/11]

template<typename T >
template<typename U = value_type>
CONSTEXPR agora::Optional< T >::Optional ( U &&  value)
inline

◆ Optional() [11/11]

template<typename T >
template<typename U >
CONSTEXPR agora::Optional< T >::Optional ( const U &  value)
inline

◆ ~Optional()

template<typename T >
agora::Optional< T >::~Optional ( )
inline

Member Function Documentation

◆ operator=() [1/6]

template<typename T >
Optional & agora::Optional< T >::operator= ( const Optional< T > &  other)
inline

◆ operator=() [2/6]

template<typename T >
Optional & agora::Optional< T >::operator= ( nullopt_t  )
inline

◆ operator=() [3/6]

template<typename T >
template<typename U >
Optional & agora::Optional< T >::operator= ( U &&  value)
inline

◆ operator=() [4/6]

template<typename T >
Optional & agora::Optional< T >::operator= ( const U &  value)
inline

◆ operator=() [5/6]

template<typename T >
template<typename U >
Optional & agora::Optional< T >::operator= ( const Optional< U > &  other)
inline

◆ operator=() [6/6]

template<typename T >
template<typename U >
Optional & agora::Optional< T >::operator= ( Optional< U > &&  other)
inline

◆ operator->() [1/2]

template<typename T >
const T * agora::Optional< T >::operator-> ( ) const
inline

◆ operator->() [2/2]

template<typename T >
T * agora::Optional< T >::operator-> ( )
inline

◆ operator*() [1/2]

template<typename T >
const T & agora::Optional< T >::operator* ( ) const
inline

◆ operator*() [2/2]

template<typename T >
T & agora::Optional< T >::operator* ( )
inline

◆ operator bool() [1/2]

template<typename T >
CONSTEXPR agora::Optional< T >::operator bool ( ) const
inlineexplicit

◆ operator bool() [2/2]

template<typename T >
CONSTEXPR agora::Optional< T >::operator bool ( ) const
inline

◆ has_value()

template<typename T >
CONSTEXPR bool agora::Optional< T >::has_value ( ) const
inline

◆ value() [1/3]

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

◆ value_or() [1/5]

template<typename T >
template<class U >
CONSTEXPR T agora::Optional< T >::value_or ( U &&  default_value) const
inline

◆ value_or() [2/5]

template<typename T >
CONSTEXPR T agora::Optional< T >::value_or ( const U &  default_value) const
inline

◆ value() [2/3]

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

◆ value() [3/3]

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

◆ value_or() [3/5]

template<typename T >
template<class U >
CONSTEXPR T agora::Optional< T >::value_or ( U &&  default_value) const &
inline

◆ value_or() [4/5]

template<typename T >
CONSTEXPR T agora::Optional< T >::value_or ( const U &  default_value) const &
inline

◆ value_or() [5/5]

template<typename T >
template<class U >
CONSTEXPR T agora::Optional< T >::value_or ( U &&  default_value) const &&
inline

◆ swap()

template<typename T >
void agora::Optional< T >::swap ( Optional< T > &  other)
inline

◆ reset()

template<typename T >
void agora::Optional< T >::reset ( )
inline

◆ emplace() [1/4]

template<typename T >
template<class... Args>
T & agora::Optional< T >::emplace ( Args &&...  args)
inline

◆ emplace() [2/4]

template<typename T >
template<class U , class... Args>
T & agora::Optional< T >::emplace ( std::initializer_list< U >  il,
Args &&...  args 
)
inline

◆ emplace() [3/4]

template<typename T >
T & agora::Optional< T >::emplace ( const T &  _value)
inline

◆ emplace() [4/4]

template<typename T >
template<class U >
T & agora::Optional< T >::emplace ( const U  il[],
const T &  _value 
)
inline