proxsuite 0.7.3
The Advanced Proximal Optimization Toolbox
Loading...
Searching...
No Matches
tl::optional< T > Class Template Reference

#include <proxsuite/helpers/tl-optional.hpp>

Inheritance diagram for tl::optional< T >:
[legend]
Collaboration diagram for tl::optional< T >:
[legend]

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 F>
TL_OPTIONAL_11_CONSTEXPR decltype(optional_map_impl(std::declval< optional & >(), std::declval< F && >())) map (F &&f) &
 Carries out some operation on the stored object if there is one.
template<class F>
TL_OPTIONAL_11_CONSTEXPR decltype(optional_map_impl(std::declval< optional && >(), std::declval< F && >())) map (F &&f) &&
template<class F>
constexpr decltype(optional_map_impl(std::declval< const optional & >(), std::declval< F && >())) map (F &&f) const &
template<class F>
constexpr decltype(optional_map_impl(std::declval< const optional && >(), std::declval< F && >())) map (F &&f) const &&
template<class F>
TL_OPTIONAL_11_CONSTEXPR decltype(optional_map_impl(std::declval< optional & >(), std::declval< F && >())) transform (F &&f) &
 Carries out some operation on the stored object if there is one.
template<class F>
TL_OPTIONAL_11_CONSTEXPR decltype(optional_map_impl(std::declval< optional && >(), std::declval< F && >())) transform (F &&f) &&
template<class F>
constexpr decltype(optional_map_impl(std::declval< const optional & >(), std::declval< F && >())) transform (F &&f) const &
template<class F>
constexpr decltype(optional_map_impl(std::declval< const optional && >(), std::declval< F && >())) transform (F &&f) const &&
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.
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 &&
template<class F, class U>
U map_or (F &&f, U &&u) &
 Maps the stored value with f if there is one, otherwise returns u.
template<class F, class U>
U map_or (F &&f, U &&u) &&
template<class F, class U>
U map_or (F &&f, U &&u) const &
template<class F, class U>
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 &&
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.
TL_OPTIONAL_11_CONSTEXPR optional disjunction (const optional &rhs) &
 Returns rhs if *this is empty, otherwise the current value.
constexpr optional disjunction (const optional &rhs) const &
TL_OPTIONAL_11_CONSTEXPR optional disjunction (const optional &rhs) &&
constexpr optional disjunction (const optional &rhs) const &&
TL_OPTIONAL_11_CONSTEXPR optional disjunction (optional &&rhs) &
constexpr optional disjunction (optional &&rhs) const &
TL_OPTIONAL_11_CONSTEXPR optional disjunction (optional &&rhs) &&
constexpr optional disjunction (optional &&rhs) const &&
optional take ()
 Takes the value out of the optional, leaving it empty.
constexpr optional () noexcept=default
 Constructs an optional that does not contain a value.
constexpr optional (nullopt_t) noexcept
TL_OPTIONAL_11_CONSTEXPR optional (const optional &rhs)=default
TL_OPTIONAL_11_CONSTEXPR optional (optional &&rhs)=default
template<class... Args>
constexpr optional (detail::enable_if_t< std::is_constructible< T, Args... >::value, in_place_t >, Args &&... args)
 Constructs the stored value in-place using the given arguments.
template<class U, class... Args>
TL_OPTIONAL_11_CONSTEXPR optional (detail::enable_if_t< std::is_constructible< T, std::initializer_list< U > &, Args &&... >::value, in_place_t >, std::initializer_list< U > il, Args &&... args)
template<class U = T, detail::enable_if_t< std::is_convertible< U &&, T >::value > * = nullptr, detail::enable_forward_value< T, U > * = nullptr>
constexpr optional (U &&u)
 Constructs the stored value with u.
template<class U = T, detail::enable_if_t<!std::is_convertible< U &&, T >::value > * = nullptr, detail::enable_forward_value< T, U > * = nullptr>
constexpr optional (U &&u)
template<class U, detail::enable_from_other< T, U, const U & > * = nullptr, detail::enable_if_t< std::is_convertible< const U &, T >::value > * = nullptr>
 optional (const optional< U > &rhs)
 Converting copy constructor.
template<class U, detail::enable_from_other< T, U, const U & > * = nullptr, detail::enable_if_t<!std::is_convertible< const U &, T >::value > * = nullptr>
 optional (const optional< U > &rhs)
template<class U, detail::enable_from_other< T, U, U && > * = nullptr, detail::enable_if_t< std::is_convertible< U &&, T >::value > * = nullptr>
 optional (optional< U > &&rhs)
 Converting move constructor.
template<class U, detail::enable_from_other< T, U, U && > * = nullptr, detail::enable_if_t<!std::is_convertible< U &&, T >::value > * = nullptr>
 optional (optional< U > &&rhs)
 ~optional ()=default
 Destroys the stored value if there is one.
optional & operator= (nullopt_t) noexcept
optional & operator= (const optional &rhs)=default
optional & operator= (optional &&rhs)=default
template<class U = T, detail::enable_assign_forward< T, U > * = nullptr>
optional & operator= (U &&u)
template<class U, detail::enable_assign_from_other< T, U, const U & > * = nullptr>
optional & operator= (const optional< U > &rhs)
template<class U, detail::enable_assign_from_other< T, U, U > * = nullptr>
optional & operator= (optional< U > &&rhs)
template<class... Args>
T & emplace (Args &&... args)
template<class U, class... Args>
detail::enable_if_t< std::is_constructible< T, std::initializer_list< U > &, Args &&... >::value, T & > emplace (std::initializer_list< U > il, Args &&... args)
void swap (optional &rhs) noexcept(std::is_nothrow_move_constructible< T >::value &&detail::is_nothrow_swappable< T >::value)
constexpr const T * operator-> () const
 Returns a pointer to the stored value.
TL_OPTIONAL_11_CONSTEXPR T * operator-> ()
TL_OPTIONAL_11_CONSTEXPR T & operator* () &
 Returns the stored value.
constexpr const T & operator* () const &
TL_OPTIONAL_11_CONSTEXPR T && operator* () &&
constexpr const T && operator* () const &&
constexpr bool has_value () const noexcept
 Returns whether or not the optional has a value.
constexpr operator bool () const noexcept
TL_OPTIONAL_11_CONSTEXPR T & value () &
TL_OPTIONAL_11_CONSTEXPR const T & value () const &
TL_OPTIONAL_11_CONSTEXPR T && value () &&
TL_OPTIONAL_11_CONSTEXPR const T && value () const &&
template<class U>
constexpr T value_or (U &&u) const &
 Returns the stored value if there is one, otherwise returns u.
template<class U>
TL_OPTIONAL_11_CONSTEXPR T value_or (U &&u) &&
void reset () noexcept
 Destroys the stored value if one exists, making the optional empty.

Detailed Description

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

An optional object is an object that contains the storage for another object and manages the lifetime of this contained object, if any. The contained object may be initialized after the optional object has been initialized, and may be destroyed before the optional object has been destroyed. The initialization state of the contained object is tracked by the optional object.

Definition at line 811 of file tl-optional.hpp.

Member Typedef Documentation

◆ value_type

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

Definition at line 1245 of file tl-optional.hpp.

Constructor & Destructor Documentation

◆ optional() [1/12]

template<class T>
tl::optional< T >::optional()
constexprdefaultnoexcept

Constructs an optional that does not contain a value.

◆ optional() [2/12]

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

Definition at line 1250 of file tl-optional.hpp.

◆ optional() [3/12]

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

Copy constructor

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

◆ optional() [4/12]

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/12]

template<class T>
template<class... Args>
tl::optional< T >::optional(detail::enable_if_t< std::is_constructible< T, Args... >::value, in_place_t >,
Args &&...args )
inlineexplicitconstexpr

Constructs the stored value in-place using the given arguments.

Definition at line 1266 of file tl-optional.hpp.

◆ optional() [6/12]

template<class T>
template<class U, class... Args>
TL_OPTIONAL_11_CONSTEXPR tl::optional< T >::optional(detail::enable_if_t< std::is_constructible< T, std::initializer_list< U > &, Args &&... >::value, in_place_t >,
std::initializer_list< U >il,
Args &&...args )
inlineexplicit

Definition at line 1274 of file tl-optional.hpp.

◆ optional() [7/12]

template<class T>
template<class U = T, detail::enable_if_t< std::is_convertible< U &&, T >::value > * = nullptr, detail::enable_forward_value< T, U > * = nullptr>
tl::optional< T >::optional(U &&u)
inlineconstexpr

Constructs the stored value with u.

Definition at line 1288 of file tl-optional.hpp.

◆ optional() [8/12]

template<class T>
template<class U = T, detail::enable_if_t<!std::is_convertible< U &&, T >::value > * = nullptr, detail::enable_forward_value< T, U > * = nullptr>
tl::optional< T >::optional(U &&u)
inlineexplicitconstexpr

Definition at line 1296 of file tl-optional.hpp.

◆ optional() [9/12]

template<class T>
template<class U, detail::enable_from_other< T, U, const U & > * = nullptr, detail::enable_if_t< std::is_convertible< const U &, T >::value > * = nullptr>
tl::optional< T >::optional(const optional< U > &rhs)
inline

Converting copy constructor.

Definition at line 1306 of file tl-optional.hpp.

◆ optional() [10/12]

template<class T>
template<class U, detail::enable_from_other< T, U, const U & > * = nullptr, detail::enable_if_t<!std::is_convertible< const U &, T >::value > * = nullptr>
tl::optional< T >::optional(const optional< U > &rhs)
inlineexplicit

Definition at line 1317 of file tl-optional.hpp.

◆ optional() [11/12]

template<class T>
template<class U, detail::enable_from_other< T, U, U && > * = nullptr, detail::enable_if_t< std::is_convertible< U &&, T >::value > * = nullptr>
tl::optional< T >::optional(optional< U > &&rhs)
inline

Converting move constructor.

Definition at line 1328 of file tl-optional.hpp.

◆ optional() [12/12]

template<class T>
template<class U, detail::enable_from_other< T, U, U && > * = nullptr, detail::enable_if_t<!std::is_convertible< U &&, T >::value > * = nullptr>
tl::optional< T >::optional(optional< U > &&rhs)
inlineexplicit

Definition at line 1338 of file tl-optional.hpp.

◆ ~optional()

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

Destroys the stored value if there is one.

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 881 of file 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 892 of file tl-optional.hpp.

◆ and_then() [3/4]

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

Definition at line 903 of file tl-optional.hpp.

◆ and_then() [4/4]

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

Definition at line 915 of file tl-optional.hpp.

◆ map() [1/4]

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

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

Definition at line 958 of file tl-optional.hpp.

◆ map() [2/4]

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

Definition at line 967 of file tl-optional.hpp.

◆ map() [3/4]

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

Definition at line 975 of file tl-optional.hpp.

◆ map() [4/4]

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

Definition at line 983 of file tl-optional.hpp.

◆ transform() [1/4]

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

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

Definition at line 1021 of file tl-optional.hpp.

◆ transform() [2/4]

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

Definition at line 1030 of file tl-optional.hpp.

◆ transform() [3/4]

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

Definition at line 1038 of file tl-optional.hpp.

◆ transform() [4/4]

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

Definition at line 1046 of file 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 1056 of file 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 1066 of file 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 1072 of file 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 1082 of file 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 1088 of file 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 1098 of file 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 1105 of file 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 1115 of file 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 1123 of file 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 1130 of file 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 1137 of file 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 1145 of file 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 1155 of file 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 1162 of file 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 1169 of file 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 1177 of file tl-optional.hpp.

◆ conjunction()

template<class T>
template<class U>
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 1186 of file 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 1193 of file tl-optional.hpp.

◆ disjunction() [2/8]

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

Definition at line 1198 of file tl-optional.hpp.

◆ disjunction() [3/8]

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

Definition at line 1203 of file tl-optional.hpp.

◆ disjunction() [4/8]

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

Definition at line 1209 of file 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 1215 of file tl-optional.hpp.

◆ disjunction() [6/8]

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

Definition at line 1220 of file tl-optional.hpp.

◆ disjunction() [7/8]

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

Definition at line 1225 of file tl-optional.hpp.

◆ disjunction() [8/8]

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

Definition at line 1231 of file 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 1238 of file tl-optional.hpp.

◆ operator=() [1/6]

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 1351 of file tl-optional.hpp.

◆ operator=() [2/6]

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

Copy assignment.

Copies the value from rhs if there is one. Otherwise resets the stored value in *this.

◆ operator=() [3/6]

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

Move assignment.

Moves the value from rhs if there is one. Otherwise resets the stored value in *this.

◆ operator=() [4/6]

template<class T>
template<class U = T, detail::enable_assign_forward< T, U > * = nullptr>
optional & tl::optional< T >::operator=(U &&u)
inline

Assigns the stored value from u, destroying the old value if there was one.

Definition at line 1376 of file tl-optional.hpp.

◆ operator=() [5/6]

template<class T>
template<class U, detail::enable_assign_from_other< T, U, const U & > * = nullptr>
optional & tl::optional< T >::operator=(const optional< U > &rhs)
inline

Converting copy assignment operator.

Copies the value from rhs if there is one. Otherwise resets the stored value in *this.

Definition at line 1392 of file tl-optional.hpp.

◆ operator=() [6/6]

template<class T>
template<class U, detail::enable_assign_from_other< T, U, U > * = nullptr>
optional & tl::optional< T >::operator=(optional< U > &&rhs)
inline

Converting move assignment operator.

Moves the value from rhs if there is one. Otherwise resets the stored value in *this.

Definition at line 1415 of file tl-optional.hpp.

◆ emplace() [1/2]

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

Constructs the value in-place, destroying the current one if there is one.

Definition at line 1435 of file tl-optional.hpp.

◆ emplace() [2/2]

template<class T>
template<class U, class... Args>
detail::enable_if_t< std::is_constructible< T, std::initializer_list< U > &, Args &&... >::value, T & > tl::optional< T >::emplace(std::initializer_list< U >il,
Args &&...args )
inline

Definition at line 1449 of file tl-optional.hpp.

◆ swap()

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

Swaps this optional with the other.

If neither optionals have a value, nothing happens. If both have a value, the values are swapped. If one has a value, it is moved to the other and the movee is left valueless.

Definition at line 1462 of file tl-optional.hpp.

◆ operator->() [1/2]

template<class T>
const T * tl::optional< T >::operator->()const
inlineconstexpr

Returns a pointer to the stored value.

Definition at line 1482 of file tl-optional.hpp.

◆ operator->() [2/2]

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

Definition at line 1487 of file tl-optional.hpp.

◆ operator*() [1/4]

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

Returns the stored value.

Definition at line 1493 of file tl-optional.hpp.

◆ operator*() [2/4]

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

Definition at line 1495 of file tl-optional.hpp.

◆ operator*() [3/4]

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

Definition at line 1497 of file tl-optional.hpp.

◆ operator*() [4/4]

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

Definition at line 1503 of file tl-optional.hpp.

◆ has_value()

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

Returns whether or not the optional has a value.

Definition at line 1507 of file tl-optional.hpp.

◆ operator bool()

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

Definition at line 1509 of file tl-optional.hpp.

◆ value() [1/4]

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 1516 of file tl-optional.hpp.

◆ value() [2/4]

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

Definition at line 1522 of file tl-optional.hpp.

◆ value() [3/4]

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

Definition at line 1528 of file tl-optional.hpp.

◆ value() [4/4]

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

Definition at line 1536 of file tl-optional.hpp.

◆ value_or() [1/2]

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

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

Definition at line 1546 of file tl-optional.hpp.

◆ value_or() [2/2]

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

Definition at line 1555 of file 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 1564 of file tl-optional.hpp.


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