Shaka Player Embedded
Public Member Functions | Friends | List of all members
shaka::optional< T > Class Template Reference

#include <optional.h>

Public Member Functions

 optional ()
 
 optional (nullopt_t)
 
 optional (std::nullptr_t)=delete
 
template<class U = T, class = typename std::enable_if< std::is_constructible<T, U&&>::value && !is_optional<typename std::decay<U>::type>::value>::type>
 optional (U &&value)
 
 optional (const optional &other)
 
 optional (optional &&other)
 
template<class U >
 optional (const optional< U > &other)
 
template<class U >
 optional (optional< U > &&other)
 
 ~optional ()
 
optionaloperator= (const optional &other)
 
optionaloperator= (optional &&other)
 
const T * operator-> () const
 
T * operator-> ()
 
const T & operator* () const &
 
T & operator* () &
 
const T && operator* () const &&
 
T && operator* () &&
 
 operator bool () const
 
bool has_value () const
 
const T & value () const &
 
T & value () &
 
const T && value () const &&
 
T && value () &&
 
template<class U >
value_or (U &&default_value) const &
 
template<class U >
value_or (U &&default_value) &&
 
void reset ()
 
template<class... Args>
T & emplace (Args &&... args)
 

Friends

template<class U >
class optional
 

Detailed Description

template<class T>
class shaka::optional< T >

This is a look-alike for the std::optional type. The most common usages of this type have been implemented, but this is not a general implementation. For example, this doesn't throw exceptions and instead asserts.

See also
https://en.cppreference.com/w/cpp/utility/optional

Definition at line 39 of file optional.h.

Constructor & Destructor Documentation

§ optional() [1/8]

template<class T>
shaka::optional< T >::optional ( )
inline

Definition at line 57 of file optional.h.

§ optional() [2/8]

template<class T>
shaka::optional< T >::optional ( nullopt_t  )
inline

Definition at line 58 of file optional.h.

§ optional() [3/8]

template<class T>
shaka::optional< T >::optional ( std::nullptr_t  )
delete

§ optional() [4/8]

template<class T>
template<class U = T, class = typename std::enable_if< std::is_constructible<T, U&&>::value && !is_optional<typename std::decay<U>::type>::value>::type>
shaka::optional< T >::optional ( U &&  value)
inline

Definition at line 65 of file optional.h.

§ optional() [5/8]

template<class T>
shaka::optional< T >::optional ( const optional< T > &  other)
inline

Definition at line 67 of file optional.h.

§ optional() [6/8]

template<class T>
shaka::optional< T >::optional ( optional< T > &&  other)
inline

Definition at line 71 of file optional.h.

§ optional() [7/8]

template<class T>
template<class U >
shaka::optional< T >::optional ( const optional< U > &  other)
inline

Definition at line 78 of file optional.h.

§ optional() [8/8]

template<class T>
template<class U >
shaka::optional< T >::optional ( optional< U > &&  other)
inline

Definition at line 83 of file optional.h.

§ ~optional()

template<class T>
shaka::optional< T >::~optional ( )
inline

Definition at line 90 of file optional.h.

Member Function Documentation

§ emplace()

template<class T>
template<class... Args>
T& shaka::optional< T >::emplace ( Args &&...  args)
inline

Definition at line 182 of file optional.h.

§ has_value()

template<class T>
bool shaka::optional< T >::has_value ( ) const
inline

Definition at line 143 of file optional.h.

§ operator bool()

template<class T>
shaka::optional< T >::operator bool ( ) const
inlineexplicit

Definition at line 140 of file optional.h.

§ operator*() [1/4]

template<class T>
const T& shaka::optional< T >::operator* ( ) const
inline

Definition at line 123 of file optional.h.

§ operator*() [2/4]

template<class T>
T& shaka::optional< T >::operator* ( )
inline

Definition at line 127 of file optional.h.

§ operator*() [3/4]

template<class T>
const T&& shaka::optional< T >::operator* ( ) const
inline

Definition at line 131 of file optional.h.

§ operator*() [4/4]

template<class T>
T&& shaka::optional< T >::operator* ( )
inline

Definition at line 135 of file optional.h.

§ operator->() [1/2]

template<class T>
const T* shaka::optional< T >::operator-> ( ) const
inline

Definition at line 115 of file optional.h.

§ operator->() [2/2]

template<class T>
T* shaka::optional< T >::operator-> ( )
inline

Definition at line 119 of file optional.h.

§ operator=() [1/2]

template<class T>
optional& shaka::optional< T >::operator= ( const optional< T > &  other)
inline

Definition at line 97 of file optional.h.

§ operator=() [2/2]

template<class T>
optional& shaka::optional< T >::operator= ( optional< T > &&  other)
inline

Definition at line 104 of file optional.h.

§ reset()

template<class T>
void shaka::optional< T >::reset ( )
inline

Definition at line 174 of file optional.h.

§ value() [1/4]

template<class T>
const T& shaka::optional< T >::value ( ) const
inline

Definition at line 147 of file optional.h.

§ value() [2/4]

template<class T>
T& shaka::optional< T >::value ( )
inline

Definition at line 151 of file optional.h.

§ value() [3/4]

template<class T>
const T&& shaka::optional< T >::value ( ) const
inline

Definition at line 155 of file optional.h.

§ value() [4/4]

template<class T>
T&& shaka::optional< T >::value ( )
inline

Definition at line 159 of file optional.h.

§ value_or() [1/2]

template<class T>
template<class U >
T shaka::optional< T >::value_or ( U &&  default_value) const
inline

Definition at line 165 of file optional.h.

§ value_or() [2/2]

template<class T>
template<class U >
T shaka::optional< T >::value_or ( U &&  default_value)
inline

Definition at line 169 of file optional.h.

Friends And Related Function Documentation

§ optional

template<class T>
template<class U >
friend class optional
friend

Definition at line 191 of file optional.h.

Member Data Documentation

§ dummy_

template<class T>
char shaka::optional< T >::dummy_

Definition at line 195 of file optional.h.

§ value_

template<class T>
T shaka::optional< T >::value_

Definition at line 194 of file optional.h.


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