QuickCppLib 0.10
Eliminate all the tedious hassle when making state-of-the-art C++ 14 - 23 libraries!
Loading...
Searching...
No Matches
std::experimental::optional< T & > Class Template Reference

#include "optional.hpp"

Public Member Functions

constexpr optional () noexcept
 
constexpr optional (nullopt_t) noexcept
 
constexpr optional (T &v) noexcept
 
 optional (T &&)=delete
 
constexpr optional (const optional &rhs) noexcept
 
constexpr optional (in_place_t, T &v) noexcept
 
 optional (in_place_t, T &&)=delete
 
 ~optional ()=default
 
optionaloperator= (nullopt_t) noexcept
 
template<typename U >
auto operator= (U &&rhs) noexcept -> typename enable_if< is_same< typename decay< U >::type, optional< T & > >::value, optional & >::type
 
template<typename U >
auto operator= (U &&rhs) noexcept -> typename enable_if< !is_same< typename decay< U >::type, optional< T & > >::value, optional & >::type=delete
 
void emplace (T &v) noexcept
 
void emplace (T &&)=delete
 
void swap (optional< T & > &rhs) noexcept
 
constexpr T * operator-> () const
 
constexpr T & operator* () const
 
constexpr T & value () const
 
constexpr operator bool () const noexcept
 
constexpr bool has_value () const noexcept
 
template<class V >
constexpr decay< T >::type value_or (V &&v) const
 
void reset () noexcept
 

Constructor & Destructor Documentation

◆ optional() [1/7]

template<class T >
constexpr std::experimental::optional< T & >::optional ( )
inlineconstexprnoexcept
630: ref(nullptr) {}

◆ optional() [2/7]

template<class T >
constexpr std::experimental::optional< T & >::optional ( nullopt_t  )
inlineconstexprnoexcept
632: ref(nullptr) {}

◆ optional() [3/7]

template<class T >
constexpr std::experimental::optional< T & >::optional ( T &  v)
inlineconstexprnoexcept
634: ref(detail_::static_addressof(v)) {}
constexpr T * static_addressof(T &ref)
Definition optional.hpp:223

◆ optional() [4/7]

template<class T >
std::experimental::optional< T & >::optional ( T &&  )
delete

◆ optional() [5/7]

template<class T >
constexpr std::experimental::optional< T & >::optional ( const optional< T & > &  rhs)
inlineconstexprnoexcept
638: ref(rhs.ref) {}
constexpr optional() noexcept
Definition optional.hpp:630

◆ optional() [6/7]

template<class T >
constexpr std::experimental::optional< T & >::optional ( in_place_t  ,
T &  v 
)
inlineexplicitconstexprnoexcept
640: ref(detail_::static_addressof(v)) {}

◆ optional() [7/7]

template<class T >
std::experimental::optional< T & >::optional ( in_place_t  ,
T &&   
)
explicitdelete

◆ ~optional()

template<class T >
std::experimental::optional< T & >::~optional ( )
default

Member Function Documentation

◆ operator=() [1/3]

template<class T >
optional & std::experimental::optional< T & >::operator= ( nullopt_t  )
inlinenoexcept
647 {
648 ref = nullptr;
649 return *this;
650 }

◆ operator=() [2/3]

template<class T >
template<typename U >
auto std::experimental::optional< T & >::operator= ( U &&  rhs) -> typename enable_if < is_same<typename decay<U>::type, optional<T&>>::value, optional& >::type
inlinenoexcept
669 {
670 ref = rhs.ref;
671 return *this;
672 }

◆ operator=() [3/3]

template<class T >
template<typename U >
auto std::experimental::optional< T & >::operator= ( U &&  rhs) -> typename enable_if< !is_same< typename decay< U >::type, optional< T & > >::value, optional & >::type=delete
deletenoexcept

◆ emplace() [1/2]

template<class T >
void std::experimental::optional< T & >::emplace ( T &  v)
inlinenoexcept
683 {
685 }

◆ emplace() [2/2]

template<class T >
void std::experimental::optional< T & >::emplace ( T &&  )
delete

◆ swap()

template<class T >
void std::experimental::optional< T & >::swap ( optional< T & > &  rhs)
inlinenoexcept
691 {
692 std::swap(ref, rhs.ref);
693 }

◆ operator->()

template<class T >
constexpr T * std::experimental::optional< T & >::operator-> ( ) const
inlineconstexpr
696 {
697 return TR2_OPTIONAL_ASSERTED_EXPRESSION(ref, ref);
698 }
#define TR2_OPTIONAL_ASSERTED_EXPRESSION(CHECK, EXPR)
Definition optional.hpp:202

◆ operator*()

template<class T >
constexpr T & std::experimental::optional< T & >::operator* ( ) const
inlineconstexpr
700 {
701 return TR2_OPTIONAL_ASSERTED_EXPRESSION(ref, *ref);
702 }

◆ value()

template<class T >
constexpr T & std::experimental::optional< T & >::value ( ) const
inlineconstexpr
704 {
705 return ref ? *ref : (throw bad_optional_access("bad optional access"), *ref);
706 }

◆ operator bool()

template<class T >
constexpr std::experimental::optional< T & >::operator bool ( ) const
inlineexplicitconstexprnoexcept
708 {
709 return ref != nullptr;
710 }

◆ has_value()

template<class T >
constexpr bool std::experimental::optional< T & >::has_value ( ) const
inlineconstexprnoexcept
712 {
713 return ref != nullptr;
714 }

◆ value_or()

template<class T >
template<class V >
constexpr decay< T >::type std::experimental::optional< T & >::value_or ( V &&  v) const
inlineconstexpr
718 {
719 return *this ? **this : detail_::convert<typename decay<T>::type>(constexpr_forward<V>(v));
720 }

◆ reset()

template<class T >
void std::experimental::optional< T & >::reset ( )
inlinenoexcept
723{ ref = nullptr; }

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