proxsuite 0.7.2
The Advanced Proximal Optimization Toolbox
Loading...
Searching...
No Matches
tl-optional.hpp File Reference
#include <new>
#include <exception>
#include <functional>
#include <type_traits>
#include <utility>
Include dependency graph for tl-optional.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  tl::monostate
 Used to represent an optional with no data; essentially a bool. More...
struct  tl::in_place_t
 A tag type to tell optional to construct its value in-place. More...
struct  tl::detail::conjunction<... >
struct  tl::detail::conjunction< B >
struct  tl::detail::conjunction< B, Bs... >
struct  tl::detail::invoke_result_impl< F, decltype(detail::invoke(std::declval< F >(), std::declval< Us >()...), void()), Us... >
struct  tl::detail::swap_adl_tests::tag
struct  tl::detail::swap_adl_tests::is_std_swap_noexcept< T >
struct  tl::detail::swap_adl_tests::is_std_swap_noexcept< T[N]>
struct  tl::detail::swap_adl_tests::is_adl_swap_noexcept< T, U >
struct  tl::detail::is_swappable< T, U >
struct  tl::detail::is_swappable< T[N], T[N]>
struct  tl::detail::is_nothrow_swappable< T, U >
struct  tl::detail::voider<... >
struct  tl::detail::is_optional_impl< T >
struct  tl::detail::is_optional_impl< optional< T > >
struct  tl::detail::returns_void_impl< F, void_t< invoke_result_t< F, U... > >, U... >
struct  tl::detail::optional_storage_base< T, bool >
struct  tl::detail::optional_storage_base< T, bool >::dummy
struct  tl::detail::optional_storage_base< T, true >
struct  tl::detail::optional_storage_base< T, true >::dummy
struct  tl::detail::optional_operations_base< T >
struct  tl::detail::optional_copy_base< T, bool >
struct  tl::detail::optional_copy_base< T, false >
struct  tl::detail::optional_move_base< T, bool >
struct  tl::detail::optional_move_base< T, false >
struct  tl::detail::optional_copy_assign_base< T, bool >
struct  tl::detail::optional_copy_assign_base< T, false >
struct  tl::detail::optional_move_assign_base< T, bool >
struct  tl::detail::optional_move_assign_base< T, false >
struct  tl::detail::optional_delete_ctor_base< T, EnableCopy, EnableMove >
struct  tl::detail::optional_delete_ctor_base< T, true, false >
struct  tl::detail::optional_delete_ctor_base< T, false, true >
struct  tl::detail::optional_delete_ctor_base< T, false, false >
struct  tl::detail::optional_delete_assign_base< T, EnableCopy, EnableMove >
struct  tl::detail::optional_delete_assign_base< T, true, false >
struct  tl::detail::optional_delete_assign_base< T, false, true >
struct  tl::detail::optional_delete_assign_base< T, false, false >
struct  tl::nullopt_t
 A tag type to represent an empty optional. More...
struct  tl::nullopt_t::do_not_use
class  tl::bad_optional_access
class  tl::optional< T >
struct  tl::detail::i_am_secret
class  tl::optional< T & >
struct  std::hash< tl::optional< T > >

Namespaces

namespace  tl
namespace  tl::detail
 \exclude
namespace  tl::detail::swap_adl_tests
namespace  std
 STL namespace.

Macros

#define TL_OPTIONAL_VERSION_MAJOR   1
#define TL_OPTIONAL_VERSION_MINOR   1
#define TL_OPTIONAL_VERSION_PATCH   0
#define TL_OPTIONAL_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T)
#define TL_OPTIONAL_IS_TRIVIALLY_COPY_ASSIGNABLE(T)
#define TL_OPTIONAL_IS_TRIVIALLY_DESTRUCTIBLE(T)
#define TL_OPTIONAL_11_CONSTEXPR   constexpr
#define TL_MONOSTATE_INPLACE_MUTEX
#define TL_TRAITS_MUTEX

Typedefs

template<class T>
using tl::detail::remove_const_t = typename std::remove_const<T>::type
template<class T>
using tl::detail::remove_reference_t = typename std::remove_reference<T>::type
template<class T>
using tl::detail::decay_t = typename std::decay<T>::type
template<bool E, class T = void>
using tl::detail::enable_if_t = typename std::enable_if<E, T>::type
template<bool B, class T, class F>
using tl::detail::conditional_t = typename std::conditional<B, T, F>::type
template<class F, class... Us>
using tl::detail::invoke_result = invoke_result_impl<F, void, Us...>
template<class F, class... Us>
using tl::detail::invoke_result_t = typename invoke_result<F, Us...>::type
template<class... Ts>
using tl::detail::void_t = typename voider<Ts...>::type
template<class T>
using tl::detail::is_optional = is_optional_impl<decay_t<T>>
template<class U>
using tl::detail::fixup_void = conditional_t<std::is_void<U>::value, monostate, U>
template<class F, class U, class = invoke_result_t<F, U>>
using tl::detail::get_map_return = optional<fixup_void<invoke_result_t<F, U>>>
template<class F, class... U>
using tl::detail::returns_void = returns_void_impl<F, void, U...>
template<class T, class... U>
using tl::detail::enable_if_ret_void = enable_if_t<returns_void<T&&, U...>::value>
template<class T, class... U>
using tl::detail::disable_if_ret_void = enable_if_t<!returns_void<T&&, U...>::value>
template<class T, class U>
using tl::detail::enable_forward_value
template<class T, class U, class Other>
using tl::detail::enable_from_other
template<class T, class U>
using tl::detail::enable_assign_forward
template<class T, class U, class Other>
using tl::detail::enable_assign_from_other

Functions

template<typename Fn, typename... Args, typename = enable_if_t<std::is_member_pointer<decay_t<Fn>>::value>, int = 0>
constexpr auto tl::detail::invoke (Fn &&f, Args &&... args) noexcept(noexcept(std::mem_fn(f)(std::forward< Args >(args)...))) -> decltype(std::mem_fn(f)(std::forward< Args >(args)...))
template<typename Fn, typename... Args, typename = enable_if_t<!std::is_member_pointer<decay_t<Fn>>::value>>
constexpr auto tl::detail::invoke (Fn &&f, Args &&... args) noexcept(noexcept(std::forward< Fn >(f)(std::forward< Args >(args)...))) -> decltype(std::forward< Fn >(f)(std::forward< Args >(args)...))
template<class T>
tag tl::detail::swap_adl_tests::swap (T &, T &)
template<class T, std::size_t N>
tag tl::detail::swap_adl_tests::swap (T(&a)[N], T(&b)[N])
template<class, class>
std::false_type tl::detail::swap_adl_tests::can_swap (...) noexcept(false)
template<class T, class U, class = decltype(swap(std::declval<T&>(), std::declval<U&>()))>
std::true_type tl::detail::swap_adl_tests::can_swap (int) noexcept(noexcept(swap(std::declval< T & >(), std::declval< U & >())))
template<class, class>
std::false_type tl::detail::swap_adl_tests::uses_std (...)
template<class T, class U>
std::is_same< decltype(swap(std::declval< T & >(), std::declval< U & >())), tagtl::detail::swap_adl_tests::uses_std (int)
template<class T, class U>
constexpr bool tl::operator== (const optional< T > &lhs, const optional< U > &rhs)
 Compares two optional objects.
template<class T, class U>
constexpr bool tl::operator!= (const optional< T > &lhs, const optional< U > &rhs)
template<class T, class U>
constexpr bool tl::operator< (const optional< T > &lhs, const optional< U > &rhs)
template<class T, class U>
constexpr bool tl::operator> (const optional< T > &lhs, const optional< U > &rhs)
template<class T, class U>
constexpr bool tl::operator<= (const optional< T > &lhs, const optional< U > &rhs)
template<class T, class U>
constexpr bool tl::operator>= (const optional< T > &lhs, const optional< U > &rhs)
template<class T>
constexpr bool tl::operator== (const optional< T > &lhs, nullopt_t) noexcept
 Compares an optional to a nullopt
template<class T>
constexpr bool tl::operator== (nullopt_t, const optional< T > &rhs) noexcept
template<class T>
constexpr bool tl::operator!= (const optional< T > &lhs, nullopt_t) noexcept
template<class T>
constexpr bool tl::operator!= (nullopt_t, const optional< T > &rhs) noexcept
template<class T>
constexpr bool tl::operator< (const optional< T > &, nullopt_t) noexcept
template<class T>
constexpr bool tl::operator< (nullopt_t, const optional< T > &rhs) noexcept
template<class T>
constexpr bool tl::operator<= (const optional< T > &lhs, nullopt_t) noexcept
template<class T>
constexpr bool tl::operator<= (nullopt_t, const optional< T > &) noexcept
template<class T>
constexpr bool tl::operator> (const optional< T > &lhs, nullopt_t) noexcept
template<class T>
constexpr bool tl::operator> (nullopt_t, const optional< T > &) noexcept
template<class T>
constexpr bool tl::operator>= (const optional< T > &, nullopt_t) noexcept
template<class T>
constexpr bool tl::operator>= (nullopt_t, const optional< T > &rhs) noexcept
template<class T, class U>
constexpr bool tl::operator== (const optional< T > &lhs, const U &rhs)
 Compares the optional with a value.
template<class T, class U>
constexpr bool tl::operator== (const U &lhs, const optional< T > &rhs)
template<class T, class U>
constexpr bool tl::operator!= (const optional< T > &lhs, const U &rhs)
template<class T, class U>
constexpr bool tl::operator!= (const U &lhs, const optional< T > &rhs)
template<class T, class U>
constexpr bool tl::operator< (const optional< T > &lhs, const U &rhs)
template<class T, class U>
constexpr bool tl::operator< (const U &lhs, const optional< T > &rhs)
template<class T, class U>
constexpr bool tl::operator<= (const optional< T > &lhs, const U &rhs)
template<class T, class U>
constexpr bool tl::operator<= (const U &lhs, const optional< T > &rhs)
template<class T, class U>
constexpr bool tl::operator> (const optional< T > &lhs, const U &rhs)
template<class T, class U>
constexpr bool tl::operator> (const U &lhs, const optional< T > &rhs)
template<class T, class U>
constexpr bool tl::operator>= (const optional< T > &lhs, const U &rhs)
template<class T, class U>
constexpr bool tl::operator>= (const U &lhs, const optional< T > &rhs)
template<class T, detail::enable_if_t< std::is_move_constructible< T >::value > * = nullptr, detail::enable_if_t< detail::is_swappable< T >::value > * = nullptr>
void tl::swap (optional< T > &lhs, optional< T > &rhs) noexcept(noexcept(lhs.swap(rhs)))
template<class T = detail::i_am_secret, class U, class Ret = detail::conditional_t<std::is_same<T, detail::i_am_secret>::value, detail::decay_t<U>, T>>
constexpr optional< Ret > tl::make_optional (U &&v)
template<class T, class... Args>
constexpr optional< T > tl::make_optional (Args &&... args)
template<class T, class U, class... Args>
constexpr optional< T > tl::make_optional (std::initializer_list< U > il, Args &&... args)
template<class Opt, class F, class Ret = decltype(detail::invoke(std::declval<F>(), *std::declval<Opt>())), detail::enable_if_t<!std::is_void< Ret >::value > * = nullptr>
constexpr auto tl::detail::optional_map_impl (Opt &&opt, F &&f) -> optional< Ret >
template<class Opt, class F, class Ret = decltype(detail::invoke(std::declval<F>(), *std::declval<Opt>())), detail::enable_if_t< std::is_void< Ret >::value > * = nullptr>
auto tl::detail::optional_map_impl (Opt &&opt, F &&f) -> optional< monostate >

Variables

static constexpr in_place_t tl::in_place {}
 A tag to tell optional to construct its value in-place.
static constexpr nullopt_t tl::nullopt
 Represents an empty optional.

Macro Definition Documentation

◆ TL_OPTIONAL_VERSION_MAJOR

#define TL_OPTIONAL_VERSION_MAJOR   1

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

◆ TL_OPTIONAL_VERSION_MINOR

#define TL_OPTIONAL_VERSION_MINOR   1

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

◆ TL_OPTIONAL_VERSION_PATCH

#define TL_OPTIONAL_VERSION_PATCH   0

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

◆ TL_OPTIONAL_IS_TRIVIALLY_COPY_CONSTRUCTIBLE

#define TL_OPTIONAL_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T)
Value:
std::is_trivially_copy_constructible<T>::value

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

◆ TL_OPTIONAL_IS_TRIVIALLY_COPY_ASSIGNABLE

#define TL_OPTIONAL_IS_TRIVIALLY_COPY_ASSIGNABLE(T)
Value:
std::is_trivially_copy_assignable<T>::value

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

◆ TL_OPTIONAL_IS_TRIVIALLY_DESTRUCTIBLE

#define TL_OPTIONAL_IS_TRIVIALLY_DESTRUCTIBLE(T)
Value:
std::is_trivially_destructible<T>::value

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

◆ TL_OPTIONAL_11_CONSTEXPR

#define TL_OPTIONAL_11_CONSTEXPR   constexpr

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

◆ TL_MONOSTATE_INPLACE_MUTEX

#define TL_MONOSTATE_INPLACE_MUTEX

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

◆ TL_TRAITS_MUTEX

#define TL_TRAITS_MUTEX

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