Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
tl::optional< T & > Class Template Reference

#include <optional.hpp>

Public Types

using value_type = T &
 

Public Member Functions

template<class F >
TL_OPTIONAL_11_CONSTEXPR detail::invoke_result_t< F, T & > and_then (F &&f) &
 
template<class F >
TL_OPTIONAL_11_CONSTEXPR detail::invoke_result_t< F, T & > and_then (F &&f) &&
 
template<class F >
constexpr detail::invoke_result_t< F, const T & > and_then (F &&f) const &
 
template<class F >
constexpr detail::invoke_result_t< F, const T & > and_then (F &&f) const &&
 
template<class U >
constexpr optional< typename std::decay< U >::type > conjunction (U &&u) const
 Returns u if *this has a value, otherwise an empty optional. More...
 
TL_OPTIONAL_11_CONSTEXPR optional disjunction (const optional &rhs) &
 Returns rhs if *this is empty, otherwise the current value. More...
 
TL_OPTIONAL_11_CONSTEXPR optional disjunction (const optional &rhs) &&
 
constexpr optional disjunction (const optional &rhs) const &
 
constexpr optional disjunction (const optional &rhs) const &&
 
TL_OPTIONAL_11_CONSTEXPR optional disjunction (optional &&rhs) &
 
TL_OPTIONAL_11_CONSTEXPR optional disjunction (optional &&rhs) &&
 
constexpr optional disjunction (optional &&rhs) const &
 
constexpr optional disjunction (optional &&rhs) const &&
 
template<class U = T, detail::enable_if_t<!detail::is_optional< detail::decay_t< U >>::value > * = nullptr>
optionalemplace (U &&u) noexcept
 Rebinds this optional to u. More...
 
constexpr bool has_value () const noexcept
 
template<class F , class U >
map_or (F &&f, U &&u) &
 Maps the stored value with f if there is one, otherwise returns u More...
 
template<class F , class U >
map_or (F &&f, U &&u) &&
 
template<class F , class U >
map_or (F &&f, U &&u) const &
 
template<class F , class U >
map_or (F &&f, U &&u) const &&
 
template<class F , class U >
detail::invoke_result_t< U > map_or_else (F &&f, U &&u) &
 
template<class F , class U >
detail::invoke_result_t< U > map_or_else (F &&f, U &&u) &&
 
template<class F , class U >
detail::invoke_result_t< U > map_or_else (F &&f, U &&u) const &
 
template<class F , class U >
detail::invoke_result_t< U > map_or_else (F &&f, U &&u) const &&
 
constexpr operator bool () const noexcept
 
constexpr const T & operator* () const noexcept
 
TL_OPTIONAL_11_CONSTEXPR T & operator* () noexcept
 Returns the stored value. More...
 
constexpr const T * operator-> () const noexcept
 Returns a pointer to the stored value. More...
 
TL_OPTIONAL_11_CONSTEXPR T * operator-> () noexcept
 
optionaloperator= (const optional &rhs)=default
 
template<class U >
optionaloperator= (const optional< U > &rhs) noexcept
 
optionaloperator= (nullopt_t) noexcept
 
template<class U = T, detail::enable_if_t<!detail::is_optional< detail::decay_t< U >>::value > * = nullptr>
optionaloperator= (U &&u)
 Rebinds this optional to u. More...
 
constexpr optional () noexcept
 Constructs an optional that does not contain a value. More...
 
TL_OPTIONAL_11_CONSTEXPR optional (const optional &rhs) noexcept=default
 
template<class U >
constexpr optional (const optional< U > &rhs) noexcept
 
constexpr optional (nullopt_t) noexcept
 
TL_OPTIONAL_11_CONSTEXPR optional (optional &&rhs)=default
 
template<class U = T, detail::enable_if_t<!detail::is_optional< detail::decay_t< U >>::value > * = nullptr>
constexpr optional (U &&u) noexcept
 Constructs the stored value with u. More...
 
template<class F , detail::enable_if_ret_void< F > * = nullptr>
optional< T > TL_OPTIONAL_11_CONSTEXPR or_else (F &&f) &
 Calls f if the optional is empty. More...
 
template<class F , detail::disable_if_ret_void< F > * = nullptr>
optional< T > TL_OPTIONAL_11_CONSTEXPR or_else (F &&f) &
 
template<class F , detail::enable_if_ret_void< F > * = nullptr>
optional< T > or_else (F &&f) &&
 
template<class F , detail::disable_if_ret_void< F > * = nullptr>
optional< T > TL_OPTIONAL_11_CONSTEXPR or_else (F &&f) &&
 
template<class F , detail::enable_if_ret_void< F > * = nullptr>
optional< T > or_else (F &&f) const &
 
template<class F , detail::disable_if_ret_void< F > * = nullptr>
optional< T > TL_OPTIONAL_11_CONSTEXPR or_else (F &&f) const &
 
template<class F , detail::enable_if_ret_void< F > * = nullptr>
optional< T > or_else (F &&f) const &&
 
template<class F , detail::disable_if_ret_void< F > * = nullptr>
optional< T > or_else (F &&f) const &&
 
void reset () noexcept
 Destroys the stored value if one exists, making the optional empty. More...
 
void swap (optional &rhs) noexcept
 
optional take ()
 Takes the value out of the optional, leaving it empty. More...
 
TL_OPTIONAL_11_CONSTEXPR T & value ()
 Returns the contained value if there is one, otherwise throws bad_optional_access. More...
 
const TL_OPTIONAL_11_CONSTEXPR T & value () const
 
template<class U >
TL_OPTIONAL_11_CONSTEXPRvalue_or (U &&u) &&noexcept
 \group value_or More...
 
template<class U >
constexpr T value_or (U &&u) const &noexcept
 Returns the stored value if there is one, otherwise returns u More...
 
 ~optional ()=default
 No-op. More...
 

Public Attributes

template<class F >
decltype(detail::optional_map_impl(std::declval< optional & >(), std::declval< F && >())) TL_OPTIONAL_11_CONSTEXPR map (F &&f) &
 Carries out some operation on the stored object if there is one. More...
 
template<class F >
decltype(detail::optional_map_impl(std::declval< optional && >(), std::declval< F && >())) TL_OPTIONAL_11_CONSTEXPR map (F &&f) &&
 
template<class F >
constexpr decltype(detail::optional_map_impl(std::declval< const optional & >(), std::declval< F && >())) map (F &&f) const &
 
template<class F >
constexpr decltype(detail::optional_map_impl(std::declval< const optional && >(), std::declval< F && >())) map (F &&f) const &&
 
template<class F >
decltype(detail::optional_map_impl(std::declval< optional & >(), std::declval< F && >())) TL_OPTIONAL_11_CONSTEXPR transform (F &&f) &
 Carries out some operation on the stored object if there is one. More...
 
template<class F >
decltype(detail::optional_map_impl(std::declval< optional && >(), std::declval< F && >())) TL_OPTIONAL_11_CONSTEXPR transform (F &&f) &&
 
template<class F >
constexpr decltype(detail::optional_map_impl(std::declval< const optional & >(), std::declval< F && >())) transform (F &&f) const &
 
template<class F >
constexpr decltype(detail::optional_map_impl(std::declval< const optional && >(), std::declval< F && >())) transform (F &&f) const &&
 

Private Attributes

T * m_value
 

Detailed Description

template<class T>
class tl::optional< T & >

Specialization for when T is a reference. optional<T&> acts similarly to a T*, but provides more operations and shows intent more clearly.

Definition at line 1560 of file 3rdparty/tl/optional.hpp.

Member Typedef Documentation

◆ value_type

template<class T >
using tl::optional< T & >::value_type = T &

Definition at line 1919 of file 3rdparty/tl/optional.hpp.

Constructor & Destructor Documentation

◆ optional() [1/6]

template<class T >
constexpr tl::optional< T & >::optional ( )
inlineconstexprnoexcept

Constructs an optional that does not contain a value.

Definition at line 1922 of file 3rdparty/tl/optional.hpp.

◆ optional() [2/6]

template<class T >
constexpr tl::optional< T & >::optional ( nullopt_t  )
inlineconstexprnoexcept

Definition at line 1924 of file 3rdparty/tl/optional.hpp.

◆ optional() [3/6]

template<class T >
TL_OPTIONAL_11_CONSTEXPR tl::optional< T & >::optional ( const optional< T & > &  rhs)
defaultnoexcept

Copy constructor

If rhs contains a value, the stored value is direct-initialized with it. Otherwise, the constructed optional is empty.

◆ optional() [4/6]

template<class T >
TL_OPTIONAL_11_CONSTEXPR tl::optional< T & >::optional ( optional< T & > &&  rhs)
default

Move constructor

If rhs contains a value, the stored value is direct-initialized with it. Otherwise, the constructed optional is empty.

◆ optional() [5/6]

template<class T >
template<class U = T, detail::enable_if_t<!detail::is_optional< detail::decay_t< U >>::value > * = nullptr>
constexpr tl::optional< T & >::optional ( U &&  u)
inlineconstexprnoexcept

Constructs the stored value with u.

Definition at line 1942 of file 3rdparty/tl/optional.hpp.

◆ optional() [6/6]

template<class T >
template<class U >
constexpr tl::optional< T & >::optional ( const optional< U > &  rhs)
inlineexplicitconstexprnoexcept

Definition at line 1947 of file 3rdparty/tl/optional.hpp.

◆ ~optional()

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

No-op.

Member Function Documentation

◆ and_then() [1/4]

template<class T >
template<class F >
TL_OPTIONAL_11_CONSTEXPR detail::invoke_result_t<F, T &> tl::optional< T & >::and_then ( F &&  f) &
inline

Carries out some operation which returns an optional on the stored object if there is one.

Definition at line 1612 of file 3rdparty/tl/optional.hpp.

◆ and_then() [2/4]

template<class T >
template<class F >
TL_OPTIONAL_11_CONSTEXPR detail::invoke_result_t<F, T &> tl::optional< T & >::and_then ( F &&  f) &&
inline

Definition at line 1622 of file 3rdparty/tl/optional.hpp.

◆ and_then() [3/4]

template<class T >
template<class F >
constexpr detail::invoke_result_t<F, const T &> tl::optional< T & >::and_then ( F &&  f) const &
inlineconstexpr

Definition at line 1632 of file 3rdparty/tl/optional.hpp.

◆ and_then() [4/4]

template<class T >
template<class F >
constexpr detail::invoke_result_t<F, const T &> tl::optional< T & >::and_then ( F &&  f) const &&
inlineconstexpr

Definition at line 1643 of file 3rdparty/tl/optional.hpp.

◆ conjunction()

template<class T >
template<class U >
constexpr optional<typename std::decay<U>::type> tl::optional< T & >::conjunction ( U &&  u) const
inlineconstexpr

Returns u if *this has a value, otherwise an empty optional.

Definition at line 1870 of file 3rdparty/tl/optional.hpp.

◆ disjunction() [1/8]

template<class T >
TL_OPTIONAL_11_CONSTEXPR optional tl::optional< T & >::disjunction ( const optional< T & > &  rhs) &
inline

Returns rhs if *this is empty, otherwise the current value.

Definition at line 1876 of file 3rdparty/tl/optional.hpp.

◆ disjunction() [2/8]

template<class T >
TL_OPTIONAL_11_CONSTEXPR optional tl::optional< T & >::disjunction ( const optional< T & > &  rhs) &&
inline

Definition at line 1884 of file 3rdparty/tl/optional.hpp.

◆ disjunction() [3/8]

template<class T >
constexpr optional tl::optional< T & >::disjunction ( const optional< T & > &  rhs) const &
inlineconstexpr

Definition at line 1880 of file 3rdparty/tl/optional.hpp.

◆ disjunction() [4/8]

template<class T >
constexpr optional tl::optional< T & >::disjunction ( const optional< T & > &  rhs) const &&
inlineconstexpr

Definition at line 1889 of file 3rdparty/tl/optional.hpp.

◆ disjunction() [5/8]

template<class T >
TL_OPTIONAL_11_CONSTEXPR optional tl::optional< T & >::disjunction ( optional< T & > &&  rhs) &
inline

Definition at line 1894 of file 3rdparty/tl/optional.hpp.

◆ disjunction() [6/8]

template<class T >
TL_OPTIONAL_11_CONSTEXPR optional tl::optional< T & >::disjunction ( optional< T & > &&  rhs) &&
inline

Definition at line 1902 of file 3rdparty/tl/optional.hpp.

◆ disjunction() [7/8]

template<class T >
constexpr optional tl::optional< T & >::disjunction ( optional< T & > &&  rhs) const &
inlineconstexpr

Definition at line 1898 of file 3rdparty/tl/optional.hpp.

◆ disjunction() [8/8]

template<class T >
constexpr optional tl::optional< T & >::disjunction ( optional< T & > &&  rhs) const &&
inlineconstexpr

Definition at line 1907 of file 3rdparty/tl/optional.hpp.

◆ emplace()

template<class T >
template<class U = T, detail::enable_if_t<!detail::is_optional< detail::decay_t< U >>::value > * = nullptr>
optional& tl::optional< T & >::emplace ( U &&  u)
inlinenoexcept

Rebinds this optional to u.

Definition at line 1989 of file 3rdparty/tl/optional.hpp.

◆ has_value()

template<class T >
constexpr bool tl::optional< T & >::has_value ( ) const
inlineconstexprnoexcept

Definition at line 2005 of file 3rdparty/tl/optional.hpp.

◆ map_or() [1/4]

template<class T >
template<class F , class U >
U tl::optional< T & >::map_or ( F &&  f,
U &&  u 
) &
inline

Maps the stored value with f if there is one, otherwise returns u

Definition at line 1818 of file 3rdparty/tl/optional.hpp.

◆ map_or() [2/4]

template<class T >
template<class F , class U >
U tl::optional< T & >::map_or ( F &&  f,
U &&  u 
) &&
inline

Definition at line 1823 of file 3rdparty/tl/optional.hpp.

◆ map_or() [3/4]

template<class T >
template<class F , class U >
U tl::optional< T & >::map_or ( F &&  f,
U &&  u 
) const &
inline

Definition at line 1828 of file 3rdparty/tl/optional.hpp.

◆ map_or() [4/4]

template<class T >
template<class F , class U >
U tl::optional< T & >::map_or ( F &&  f,
U &&  u 
) const &&
inline

Definition at line 1834 of file 3rdparty/tl/optional.hpp.

◆ map_or_else() [1/4]

template<class T >
template<class F , class U >
detail::invoke_result_t<U> tl::optional< T & >::map_or_else ( F &&  f,
U &&  u 
) &
inline

Maps the stored value with f if there is one, otherwise calls u and returns the result.

Definition at line 1843 of file 3rdparty/tl/optional.hpp.

◆ map_or_else() [2/4]

template<class T >
template<class F , class U >
detail::invoke_result_t<U> tl::optional< T & >::map_or_else ( F &&  f,
U &&  u 
) &&
inline

Definition at line 1849 of file 3rdparty/tl/optional.hpp.

◆ map_or_else() [3/4]

template<class T >
template<class F , class U >
detail::invoke_result_t<U> tl::optional< T & >::map_or_else ( F &&  f,
U &&  u 
) const &
inline

Definition at line 1855 of file 3rdparty/tl/optional.hpp.

◆ map_or_else() [4/4]

template<class T >
template<class F , class U >
detail::invoke_result_t<U> tl::optional< T & >::map_or_else ( F &&  f,
U &&  u 
) const &&
inline

Definition at line 1862 of file 3rdparty/tl/optional.hpp.

◆ operator bool()

template<class T >
constexpr tl::optional< T & >::operator bool ( ) const
inlineexplicitconstexprnoexcept

Definition at line 2007 of file 3rdparty/tl/optional.hpp.

◆ operator*() [1/2]

template<class T >
constexpr const T& tl::optional< T & >::operator* ( ) const
inlineconstexprnoexcept

Definition at line 2003 of file 3rdparty/tl/optional.hpp.

◆ operator*() [2/2]

template<class T >
TL_OPTIONAL_11_CONSTEXPR T& tl::optional< T & >::operator* ( )
inlinenoexcept

Returns the stored value.

Definition at line 2001 of file 3rdparty/tl/optional.hpp.

◆ operator->() [1/2]

template<class T >
constexpr const T* tl::optional< T & >::operator-> ( ) const
inlineconstexprnoexcept

Returns a pointer to the stored value.

Definition at line 1996 of file 3rdparty/tl/optional.hpp.

◆ operator->() [2/2]

template<class T >
TL_OPTIONAL_11_CONSTEXPR T* tl::optional< T & >::operator-> ( )
inlinenoexcept

Definition at line 1998 of file 3rdparty/tl/optional.hpp.

◆ operator=() [1/4]

template<class T >
optional& tl::optional< T & >::operator= ( const optional< T & > &  rhs)
default

Copy assignment.

Rebinds this optional to the referee of rhs if there is one. Otherwise resets the stored value in *this.

◆ operator=() [2/4]

template<class T >
template<class U >
optional& tl::optional< T & >::operator= ( const optional< U > &  rhs)
inlinenoexcept

Converting copy assignment operator.

Rebinds this optional to the referee of rhs if there is one. Otherwise resets the stored value in *this.

Definition at line 1980 of file 3rdparty/tl/optional.hpp.

◆ operator=() [3/4]

template<class T >
optional& tl::optional< T & >::operator= ( nullopt_t  )
inlinenoexcept

Assignment to empty.

Destroys the current value if there is one.

Definition at line 1955 of file 3rdparty/tl/optional.hpp.

◆ operator=() [4/4]

template<class T >
template<class U = T, detail::enable_if_t<!detail::is_optional< detail::decay_t< U >>::value > * = nullptr>
optional& tl::optional< T & >::operator= ( U &&  u)
inline

Rebinds this optional to u.

Definition at line 1970 of file 3rdparty/tl/optional.hpp.

◆ or_else() [1/8]

template<class T >
template<class F , detail::enable_if_ret_void< F > * = nullptr>
optional<T> TL_OPTIONAL_11_CONSTEXPR tl::optional< T & >::or_else ( F &&  f) &
inline

Calls f if the optional is empty.

Definition at line 1760 of file 3rdparty/tl/optional.hpp.

◆ or_else() [2/8]

template<class T >
template<class F , detail::disable_if_ret_void< F > * = nullptr>
optional<T> TL_OPTIONAL_11_CONSTEXPR tl::optional< T & >::or_else ( F &&  f) &
inline

Definition at line 1769 of file 3rdparty/tl/optional.hpp.

◆ or_else() [3/8]

template<class T >
template<class F , detail::enable_if_ret_void< F > * = nullptr>
optional<T> tl::optional< T & >::or_else ( F &&  f) &&
inline

Definition at line 1774 of file 3rdparty/tl/optional.hpp.

◆ or_else() [4/8]

template<class T >
template<class F , detail::disable_if_ret_void< F > * = nullptr>
optional<T> TL_OPTIONAL_11_CONSTEXPR tl::optional< T & >::or_else ( F &&  f) &&
inline

Definition at line 1783 of file 3rdparty/tl/optional.hpp.

◆ or_else() [5/8]

template<class T >
template<class F , detail::enable_if_ret_void< F > * = nullptr>
optional<T> tl::optional< T & >::or_else ( F &&  f) const &
inline

Definition at line 1788 of file 3rdparty/tl/optional.hpp.

◆ or_else() [6/8]

template<class T >
template<class F , detail::disable_if_ret_void< F > * = nullptr>
optional<T> TL_OPTIONAL_11_CONSTEXPR tl::optional< T & >::or_else ( F &&  f) const &
inline

Definition at line 1797 of file 3rdparty/tl/optional.hpp.

◆ or_else() [7/8]

template<class T >
template<class F , detail::enable_if_ret_void< F > * = nullptr>
optional<T> tl::optional< T & >::or_else ( F &&  f) const &&
inline

Definition at line 1803 of file 3rdparty/tl/optional.hpp.

◆ or_else() [8/8]

template<class T >
template<class F , detail::disable_if_ret_void< F > * = nullptr>
optional<T> tl::optional< T & >::or_else ( F &&  f) const &&
inline

Definition at line 1812 of file 3rdparty/tl/optional.hpp.

◆ reset()

template<class T >
void tl::optional< T & >::reset ( )
inlinenoexcept

Destroys the stored value if one exists, making the optional empty.

Definition at line 2040 of file 3rdparty/tl/optional.hpp.

◆ swap()

template<class T >
void tl::optional< T & >::swap ( optional< T & > &  rhs)
inlinenoexcept

Definition at line 1993 of file 3rdparty/tl/optional.hpp.

◆ take()

template<class T >
optional tl::optional< T & >::take ( )
inline

Takes the value out of the optional, leaving it empty.

Definition at line 1913 of file 3rdparty/tl/optional.hpp.

◆ value() [1/2]

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

Returns the contained value if there is one, otherwise throws bad_optional_access.

Definition at line 2012 of file 3rdparty/tl/optional.hpp.

◆ value() [2/2]

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

Definition at line 2017 of file 3rdparty/tl/optional.hpp.

◆ value_or() [1/2]

template<class T >
template<class U >
TL_OPTIONAL_11_CONSTEXPR T tl::optional< T & >::value_or ( U &&  u) &&
inlinenoexcept

\group value_or

Definition at line 2032 of file 3rdparty/tl/optional.hpp.

◆ value_or() [2/2]

template<class T >
template<class U >
constexpr T tl::optional< T & >::value_or ( U &&  u) const &
inlineconstexprnoexcept

Returns the stored value if there is one, otherwise returns u

Definition at line 2024 of file 3rdparty/tl/optional.hpp.

Member Data Documentation

◆ m_value

template<class T >
T* tl::optional< T & >::m_value
private

Definition at line 2043 of file 3rdparty/tl/optional.hpp.

◆ map [1/4]

template<class T >
template<class F >
decltype(detail::optional_map_impl(std::declval<optional &>(), std::declval<F &&>())) TL_OPTIONAL_11_CONSTEXPR tl::optional< T & >::map(F &&f) &
inline

Carries out some operation on the stored object if there is one.

Definition at line 1677 of file 3rdparty/tl/optional.hpp.

◆ map [2/4]

template<class T >
template<class F >
decltype(detail::optional_map_impl(std::declval<optional &&>(), std::declval<F &&>())) TL_OPTIONAL_11_CONSTEXPR tl::optional< T & >::map(F &&f) &&
inline

Definition at line 1684 of file 3rdparty/tl/optional.hpp.

◆ map [3/4]

template<class T >
template<class F >
constexpr decltype(detail::optional_map_impl(std::declval<const optional &>(), std::declval<F &&>())) tl::optional< T & >::map(F &&f) const &
inlineconstexpr

Definition at line 1691 of file 3rdparty/tl/optional.hpp.

◆ map [4/4]

template<class T >
template<class F >
constexpr decltype(detail::optional_map_impl(std::declval<const optional &&>(), std::declval<F &&>())) tl::optional< T & >::map(F &&f) const &&
inlineconstexpr

Definition at line 1699 of file 3rdparty/tl/optional.hpp.

◆ transform [1/4]

template<class T >
template<class F >
decltype(detail::optional_map_impl(std::declval<optional&>(), std::declval<F&&>())) TL_OPTIONAL_11_CONSTEXPR tl::optional< T & >::transform(F &&f) &
inline

Carries out some operation on the stored object if there is one.

Definition at line 1728 of file 3rdparty/tl/optional.hpp.

◆ transform [2/4]

template<class T >
template<class F >
decltype(detail::optional_map_impl(std::declval<optional&&>(), std::declval<F&&>())) TL_OPTIONAL_11_CONSTEXPR tl::optional< T & >::transform(F &&f) &&
inline

\group map \synopsis template <class F> auto transform(F &&f) &&;

Definition at line 1737 of file 3rdparty/tl/optional.hpp.

◆ transform [3/4]

template<class T >
template<class F >
constexpr decltype(detail::optional_map_impl(std::declval<const optional&>(), std::declval<F&&>())) tl::optional< T & >::transform(F &&f) const &
inlineconstexpr

Definition at line 1744 of file 3rdparty/tl/optional.hpp.

◆ transform [4/4]

template<class T >
template<class F >
constexpr decltype(detail::optional_map_impl(std::declval<const optional&&>(), std::declval<F&&>())) tl::optional< T & >::transform(F &&f) const &&
inlineconstexpr

Definition at line 1752 of file 3rdparty/tl/optional.hpp.


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


depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:20