LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
expected.hpp File Reference
#include <exception>
#include <functional>
#include <type_traits>
#include <utility>
Include dependency graph for expected.hpp:

Go to the source code of this file.

Classes

class  tl::monostate
struct  tl::in_place_t
class  tl::unexpected< E >
struct  tl::unexpect_t
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::is_expected_impl< T >
struct  tl::detail::is_expected_impl< expected< T, E > >
struct  tl::detail::no_init_t
struct  tl::detail::expected_storage_base< T, E, bool, bool >
struct  tl::detail::expected_storage_base< T, E, true, true >
struct  tl::detail::expected_storage_base< T, E, true, false >
struct  tl::detail::expected_storage_base< T, E, false, true >
struct  tl::detail::expected_storage_base< void, E, false, true >
struct  tl::detail::expected_storage_base< void, E, false, true >::dummy
struct  tl::detail::expected_storage_base< void, E, false, false >
struct  tl::detail::expected_operations_base< T, E >
struct  tl::detail::expected_operations_base< void, E >
struct  tl::detail::expected_copy_base< T, E, bool, bool >
struct  tl::detail::expected_copy_base< T, E, false, true >
struct  tl::detail::expected_move_base< T, E, bool >
struct  tl::detail::expected_move_base< T, E, false >
struct  tl::detail::expected_copy_assign_base< T, E, bool, bool >
struct  tl::detail::expected_copy_assign_base< T, E, false, true >
struct  tl::detail::expected_move_assign_base< T, E, bool >
struct  tl::detail::expected_move_assign_base< T, E, false >
struct  tl::detail::expected_delete_ctor_base< T, E, EnableCopy, EnableMove >
struct  tl::detail::expected_delete_ctor_base< T, E, true, false >
struct  tl::detail::expected_delete_ctor_base< T, E, false, true >
struct  tl::detail::expected_delete_ctor_base< T, E, false, false >
struct  tl::detail::expected_delete_assign_base< T, E, EnableCopy, EnableMove >
struct  tl::detail::expected_delete_assign_base< T, E, true, false >
struct  tl::detail::expected_delete_assign_base< T, E, false, true >
struct  tl::detail::expected_delete_assign_base< T, E, false, false >
struct  tl::detail::default_constructor_tag
struct  tl::detail::expected_default_ctor_base< T, E, Enable >
struct  tl::detail::expected_default_ctor_base< T, E, false >
class  tl::bad_expected_access< E >
class  tl::expected< T, E >
 An expected<T, E> object is an object that contains the storage for another object and manages the lifetime of this contained object T. Alternatively it could contain the storage for another unexpected object E. The contained object may not be initialized after the expected object has been initialized, and may not be destroyed before the expected object has been destroyed. The initialization state of the contained object is tracked by the expected object. More...

Namespaces

namespace  tl
namespace  tl::detail
namespace  tl::detail::swap_adl_tests

Macros

#define TL_EXPECTED_VERSION_MAJOR   1
#define TL_EXPECTED_VERSION_MINOR   3
#define TL_EXPECTED_VERSION_PATCH   1
#define TL_EXPECTED_MSVC2015_CONSTEXPR   constexpr
#define TL_CPLUSPLUS   __cplusplus
#define TL_ASSERT(x)
#define TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T)
#define TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(T)
#define TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(T)
#define TL_EXPECTED_GCC49_CONSTEXPR   constexpr
#define TL_EXPECTED_11_CONSTEXPR   constexpr
#define TL_EXPECTED_NODISCARD
#define TL_MONOSTATE_INPLACE_MUTEX
#define TL_EXPECTED_THROW_EXCEPTION(e)
#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 T>
using tl::detail::is_expected = is_expected_impl<decay_t<T>>
template<class T, class E, class U>
using tl::detail::expected_enable_forward_value
template<class T, class E, class U, class G, class UR, class GR>
using tl::detail::expected_enable_from_other
template<class T, class U>
using tl::detail::is_void_or = conditional_t<std::is_void<T>::value, std::true_type, U>
template<class T>
using tl::detail::is_copy_constructible_or_void
template<class T>
using tl::detail::is_move_constructible_or_void
template<class T>
using tl::detail::is_copy_assignable_or_void = is_void_or<T, std::is_copy_assignable<T>>
template<class T>
using tl::detail::is_move_assignable_or_void = is_void_or<T, std::is_move_assignable<T>>
template<class Exp>
using tl::detail::exp_t = typename detail::decay_t<Exp>::value_type
template<class Exp>
using tl::detail::err_t = typename detail::decay_t<Exp>::error_type
template<class Exp, class Ret>
using tl::detail::ret_t = expected<Ret, err_t<Exp>>

Functions

template<class E>
constexpr bool tl::operator== (const unexpected< E > &lhs, const unexpected< E > &rhs)
template<class E>
constexpr bool tl::operator!= (const unexpected< E > &lhs, const unexpected< E > &rhs)
template<class E>
constexpr bool tl::operator< (const unexpected< E > &lhs, const unexpected< E > &rhs)
template<class E>
constexpr bool tl::operator<= (const unexpected< E > &lhs, const unexpected< E > &rhs)
template<class E>
constexpr bool tl::operator> (const unexpected< E > &lhs, const unexpected< E > &rhs)
template<class E>
constexpr bool tl::operator>= (const unexpected< E > &lhs, const unexpected< E > &rhs)
template<class E>
unexpected< typename std::decay< E >::type > tl::make_unexpected (E &&e)
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 Exp, class F, class Ret = decltype(detail::invoke(std::declval<F>(), *std::declval<Exp>())), detail::enable_if_t<!std::is_void< exp_t< Exp > >::value > * = nullptr>
auto tl::detail::and_then_impl (Exp &&exp, F &&f) -> Ret
template<class Exp, class F, class Ret = decltype(detail::invoke(std::declval<F>())), detail::enable_if_t< std::is_void< exp_t< Exp > >::value > * = nullptr>
constexpr auto tl::detail::and_then_impl (Exp &&exp, F &&f) -> Ret
template<class Exp, class F, detail::enable_if_t<!std::is_void< exp_t< Exp > >::value > * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), *std::declval<Exp>())), detail::enable_if_t<!std::is_void< Ret >::value > * = nullptr>
constexpr auto tl::detail::expected_map_impl (Exp &&exp, F &&f) -> ret_t< Exp, detail::decay_t< Ret > >
template<class Exp, class F, detail::enable_if_t<!std::is_void< exp_t< Exp > >::value > * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), *std::declval<Exp>())), detail::enable_if_t< std::is_void< Ret >::value > * = nullptr>
auto tl::detail::expected_map_impl (Exp &&exp, F &&f) -> expected< void, err_t< Exp > >
template<class Exp, class F, detail::enable_if_t< std::is_void< exp_t< Exp > >::value > * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>())), detail::enable_if_t<!std::is_void< Ret >::value > * = nullptr>
constexpr auto tl::detail::expected_map_impl (Exp &&exp, F &&f) -> ret_t< Exp, detail::decay_t< Ret > >
template<class Exp, class F, detail::enable_if_t< std::is_void< exp_t< Exp > >::value > * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>())), detail::enable_if_t< std::is_void< Ret >::value > * = nullptr>
auto tl::detail::expected_map_impl (Exp &&exp, F &&f) -> expected< void, err_t< Exp > >
template<class Exp, class F, detail::enable_if_t<!std::is_void< exp_t< Exp > >::value > * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<!std::is_void< Ret >::value > * = nullptr>
constexpr auto tl::detail::map_error_impl (Exp &&exp, F &&f) -> expected< exp_t< Exp >, detail::decay_t< Ret > >
template<class Exp, class F, detail::enable_if_t<!std::is_void< exp_t< Exp > >::value > * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t< std::is_void< Ret >::value > * = nullptr>
auto tl::detail::map_error_impl (Exp &&exp, F &&f) -> expected< exp_t< Exp >, monostate >
template<class Exp, class F, detail::enable_if_t< std::is_void< exp_t< Exp > >::value > * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<!std::is_void< Ret >::value > * = nullptr>
constexpr auto tl::detail::map_error_impl (Exp &&exp, F &&f) -> expected< exp_t< Exp >, detail::decay_t< Ret > >
template<class Exp, class F, detail::enable_if_t< std::is_void< exp_t< Exp > >::value > * = nullptr, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t< std::is_void< Ret >::value > * = nullptr>
auto tl::detail::map_error_impl (Exp &&exp, F &&f) -> expected< exp_t< Exp >, monostate >
template<class Exp, class F, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t<!std::is_void< Ret >::value > * = nullptr>
auto tl::detail::or_else_impl (Exp &&exp, F &&f) -> Ret
template<class Exp, class F, class Ret = decltype(detail::invoke(std::declval<F>(), std::declval<Exp>().error())), detail::enable_if_t< std::is_void< Ret >::value > * = nullptr>
detail::decay_t< Exp > tl::detail::or_else_impl (Exp &&exp, F &&f)
template<class T, class E, class U, class F>
constexpr bool tl::operator== (const expected< T, E > &lhs, const expected< U, F > &rhs)
template<class T, class E, class U, class F>
constexpr bool tl::operator!= (const expected< T, E > &lhs, const expected< U, F > &rhs)
template<class E, class F>
constexpr bool tl::operator== (const expected< void, E > &lhs, const expected< void, F > &rhs)
template<class E, class F>
constexpr bool tl::operator!= (const expected< void, E > &lhs, const expected< void, F > &rhs)
template<class T, class E, class U>
constexpr bool tl::operator== (const expected< T, E > &x, const U &v)
template<class T, class E, class U>
constexpr bool tl::operator== (const U &v, const expected< T, E > &x)
template<class T, class E, class U>
constexpr bool tl::operator!= (const expected< T, E > &x, const U &v)
template<class T, class E, class U>
constexpr bool tl::operator!= (const U &v, const expected< T, E > &x)
template<class T, class E>
constexpr bool tl::operator== (const expected< T, E > &x, const unexpected< E > &e)
template<class T, class E>
constexpr bool tl::operator== (const unexpected< E > &e, const expected< T, E > &x)
template<class T, class E>
constexpr bool tl::operator!= (const expected< T, E > &x, const unexpected< E > &e)
template<class T, class E>
constexpr bool tl::operator!= (const unexpected< E > &e, const expected< T, E > &x)
template<class T, class E, detail::enable_if_t<(std::is_void< T >::value||std::is_move_constructible< T >::value) &&detail::is_swappable< T >::value &&std::is_move_constructible< E >::value &&detail::is_swappable< E >::value > * = nullptr>
void tl::swap (expected< T, E > &lhs, expected< T, E > &rhs) noexcept(noexcept(lhs.swap(rhs)))

Macro Definition Documentation

◆ TL_ASSERT

◆ TL_CPLUSPLUS

#define TL_CPLUSPLUS   __cplusplus

◆ TL_EXPECTED_11_CONSTEXPR

◆ TL_EXPECTED_GCC49_CONSTEXPR

#define TL_EXPECTED_GCC49_CONSTEXPR   constexpr

◆ TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE

#define TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE ( T)
Value:
std::is_trivially_copy_assignable<T>

◆ TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE

#define TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE ( T)
Value:
std::is_trivially_copy_constructible<T>

◆ TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE

#define TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE ( T)
Value:
std::is_trivially_destructible<T>

◆ TL_EXPECTED_MSVC2015_CONSTEXPR

◆ TL_EXPECTED_NODISCARD

#define TL_EXPECTED_NODISCARD

◆ TL_EXPECTED_THROW_EXCEPTION

◆ TL_EXPECTED_VERSION_MAJOR

#define TL_EXPECTED_VERSION_MAJOR   1

◆ TL_EXPECTED_VERSION_MINOR

#define TL_EXPECTED_VERSION_MINOR   3

◆ TL_EXPECTED_VERSION_PATCH

#define TL_EXPECTED_VERSION_PATCH   1

◆ TL_MONOSTATE_INPLACE_MUTEX

#define TL_MONOSTATE_INPLACE_MUTEX

◆ TL_TRAITS_MUTEX

#define TL_TRAITS_MUTEX