Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qexpected_p.h File Reference

(901ccf760891cc3aa1adf2f6c8105c6417f4783a)

#include <QtCore/private/qglobal_p.h>
#include <QtCore/qassert.h>
#include <QtCore/qtconfiginclude.h>
#include <QtCore/qtconfigmacros.h>
#include <exception>
#include <functional>
#include <type_traits>
#include <utility>
Include dependency graph for qexpected_p.h:

Go to the source code of this file.

Classes

class  q23::monostate
struct  q23::in_place_t
class  q23::unexpected< E >
struct  q23::unexpect_t
struct  q23::detail::conjunction<... >
struct  q23::detail::conjunction< B >
struct  q23::detail::conjunction< B, Bs... >
struct  q23::detail::invoke_result_impl< F, decltype(detail::invoke(std::declval< F >(), std::declval< Us >()...), void()), Us... >
struct  q23::detail::swap_adl_tests::tag
struct  q23::detail::swap_adl_tests::is_std_swap_noexcept< T >
struct  q23::detail::swap_adl_tests::is_std_swap_noexcept< T[N]>
struct  q23::detail::swap_adl_tests::is_adl_swap_noexcept< T, U >
struct  q23::detail::is_swappable< T, U >
struct  q23::detail::is_swappable< T[N], T[N]>
struct  q23::detail::is_nothrow_swappable< T, U >
struct  q23::detail::is_expected_impl< T >
struct  q23::detail::is_expected_impl< expected< T, E > >
struct  q23::detail::no_init_t
struct  q23::detail::expected_storage_base< T, E, bool, bool >
struct  q23::detail::expected_storage_base< T, E, true, true >
struct  q23::detail::expected_storage_base< T, E, true, false >
struct  q23::detail::expected_storage_base< T, E, false, true >
struct  q23::detail::expected_storage_base< void, E, false, true >
struct  q23::detail::expected_storage_base< void, E, false, true >::dummy
struct  q23::detail::expected_storage_base< void, E, false, false >
struct  q23::detail::expected_operations_base< T, E >
struct  q23::detail::expected_operations_base< void, E >
struct  q23::detail::expected_copy_base< T, E, bool, bool >
struct  q23::detail::expected_copy_base< T, E, false, true >
struct  q23::detail::expected_move_base< T, E, bool >
struct  q23::detail::expected_move_base< T, E, false >
struct  q23::detail::expected_copy_assign_base< T, E, bool, bool >
struct  q23::detail::expected_copy_assign_base< T, E, false, true >
struct  q23::detail::expected_move_assign_base< T, E, bool >
struct  q23::detail::expected_move_assign_base< T, E, false >
struct  q23::detail::expected_delete_ctor_base< T, E, EnableCopy, EnableMove >
struct  q23::detail::expected_delete_ctor_base< T, E, true, false >
struct  q23::detail::expected_delete_ctor_base< T, E, false, true >
struct  q23::detail::expected_delete_ctor_base< T, E, false, false >
struct  q23::detail::expected_delete_assign_base< T, E, EnableCopy, EnableMove >
struct  q23::detail::expected_delete_assign_base< T, E, true, false >
struct  q23::detail::expected_delete_assign_base< T, E, false, true >
struct  q23::detail::expected_delete_assign_base< T, E, false, false >
struct  q23::detail::default_constructor_tag
struct  q23::detail::expected_default_ctor_base< T, E, Enable >
struct  q23::detail::expected_default_ctor_base< T, E, false >
class  q23::bad_expected_access< E >
class  q23::expected< T, E >

Namespaces

namespace  q23
namespace  q23::detail
namespace  q23::detail::swap_adl_tests

Macros

#define TL_EXPECTED_VERSION_MAJOR   1
#define TL_EXPECTED_VERSION_MINOR   1
#define TL_EXPECTED_VERSION_PATCH   0
#define TL_ASSERT   Q_ASSERT
#define TL_EXPECTED_MSVC2015_CONSTEXPR   constexpr
#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_CPLUSPLUS   __cplusplus
#define TL_EXPECTED_GCC49_CONSTEXPR   constexpr
#define TL_EXPECTED_11_CONSTEXPR   constexpr
#define TL_MONOSTATE_INPLACE_MUTEX
#define TL_TRAITS_MUTEX

Typedefs

template<class T>
using q23::detail::remove_const_t = typename std::remove_const<T>::type
template<class T>
using q23::detail::remove_reference_t = typename std::remove_reference<T>::type
template<class T>
using q23::detail::decay_t = typename std::decay<T>::type
template<bool E, class T = void>
using q23::detail::enable_if_t = typename std::enable_if<E, T>::type
template<bool B, class T, class F>
using q23::detail::conditional_t = typename std::conditional<B, T, F>::type
template<class F, class... Us>
using q23::detail::invoke_result = invoke_result_impl<F, void, Us...>
template<class F, class... Us>
using q23::detail::invoke_result_t = typename invoke_result<F, Us...>::type
template<class T>
using q23::detail::is_expected = is_expected_impl<decay_t<T>>
template<class T, class E, class U>
using q23::detail::expected_enable_forward_value
template<class T, class E, class U, class G, class UR, class GR>
using q23::detail::expected_enable_from_other
template<class T, class U>
using q23::detail::is_void_or = conditional_t<std::is_void<T>::value, std::true_type, U>
template<class T>
using q23::detail::is_copy_constructible_or_void
template<class T>
using q23::detail::is_move_constructible_or_void
template<class T>
using q23::detail::is_copy_assignable_or_void = is_void_or<T, std::is_copy_assignable<T>>
template<class T>
using q23::detail::is_move_assignable_or_void = is_void_or<T, std::is_move_assignable<T>>
template<class Exp>
using q23::detail::exp_t = typename detail::decay_t<Exp>::value_type
template<class Exp>
using q23::detail::err_t = typename detail::decay_t<Exp>::error_type
template<class Exp, class Ret>
using q23::detail::ret_t = expected<Ret, err_t<Exp>>

Functions

template<class E>
constexpr bool q23::operator== (const unexpected< E > &lhs, const unexpected< E > &rhs)
template<class E>
constexpr bool q23::operator!= (const unexpected< E > &lhs, const unexpected< E > &rhs)
template<class E>
constexpr bool q23::operator< (const unexpected< E > &lhs, const unexpected< E > &rhs)
template<class E>
constexpr bool q23::operator<= (const unexpected< E > &lhs, const unexpected< E > &rhs)
template<class E>
constexpr bool q23::operator> (const unexpected< E > &lhs, const unexpected< E > &rhs)
template<class E>
constexpr bool q23::operator>= (const unexpected< E > &lhs, const unexpected< E > &rhs)
template<class E>
unexpected< typename std::decay< E >::typeq23::make_unexpected (E &&e)
template<typename E>
TL_EXPECTED_11_CONSTEXPR void q23::detail::throw_exception (E &&e)
template<typename Fn, typename... Args, typename = enable_if_t<std::is_member_pointer<decay_t<Fn>>::value>, int = 0>
constexpr auto q23::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 q23::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 q23::detail::swap_adl_tests::swap (T &, T &)
template<class T, std::size_t N>
tag q23::detail::swap_adl_tests::swap (T(&a)[N], T(&b)[N])
template<class, class>
std::false_type q23::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 q23::detail::swap_adl_tests::can_swap (int) noexcept(noexcept(swap(std::declval< T & >(), std::declval< U & >())))
template<class, class>
std::false_type q23::detail::swap_adl_tests::uses_std (...)
template<class T, class U>
std::is_same< decltype(swap(std::declval< T & >(), std::declval< U & >())), tagq23::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 q23::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 q23::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 q23::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 q23::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 q23::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 q23::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 q23::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 q23::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 q23::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 q23::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 q23::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 > q23::detail::or_else_impl (Exp &&exp, F &&f)
template<class T, class E, class U, class F>
constexpr bool q23::operator== (const expected< T, E > &lhs, const expected< U, F > &rhs)
template<class T, class E, class U, class F>
constexpr bool q23::operator!= (const expected< T, E > &lhs, const expected< U, F > &rhs)
template<class E, class F>
constexpr bool q23::operator== (const expected< void, E > &lhs, const expected< void, F > &rhs)
template<class E, class F>
constexpr bool q23::operator!= (const expected< void, E > &lhs, const expected< void, F > &rhs)
template<class T, class E, class U>
constexpr bool q23::operator== (const expected< T, E > &x, const U &v)
template<class T, class E, class U>
constexpr bool q23::operator== (const U &v, const expected< T, E > &x)
template<class T, class E, class U>
constexpr bool q23::operator!= (const expected< T, E > &x, const U &v)
template<class T, class E, class U>
constexpr bool q23::operator!= (const U &v, const expected< T, E > &x)
template<class T, class E>
constexpr bool q23::operator== (const expected< T, E > &x, const unexpected< E > &e)
template<class T, class E>
constexpr bool q23::operator== (const unexpected< E > &e, const expected< T, E > &x)
template<class T, class E>
constexpr bool q23::operator!= (const expected< T, E > &x, const unexpected< E > &e)
template<class T, class E>
constexpr bool q23::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 q23::swap (expected< T, E > &lhs, expected< T, E > &rhs) noexcept(noexcept(lhs.swap(rhs)))

Variables

static constexpr in_place_t q23::in_place {}
static constexpr unexpect_t q23::unexpect {}
static constexpr no_init_t q23::detail::no_init {}

Macro Definition Documentation

◆ TL_ASSERT

#define TL_ASSERT   Q_ASSERT

Definition at line 47 of file qexpected_p.h.

◆ TL_CPLUSPLUS

#define TL_CPLUSPLUS   __cplusplus

Definition at line 142 of file qexpected_p.h.

◆ TL_EXPECTED_11_CONSTEXPR

#define TL_EXPECTED_11_CONSTEXPR   constexpr

Definition at line 159 of file qexpected_p.h.

◆ TL_EXPECTED_GCC49_CONSTEXPR

#define TL_EXPECTED_GCC49_CONSTEXPR   constexpr

Definition at line 152 of file qexpected_p.h.

◆ TL_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE

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

Definition at line 133 of file qexpected_p.h.

◆ TL_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE

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

Definition at line 131 of file qexpected_p.h.

◆ TL_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE

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

Definition at line 135 of file qexpected_p.h.

◆ TL_EXPECTED_MSVC2015_CONSTEXPR

#define TL_EXPECTED_MSVC2015_CONSTEXPR   constexpr

Definition at line 61 of file qexpected_p.h.

◆ TL_EXPECTED_VERSION_MAJOR

#define TL_EXPECTED_VERSION_MAJOR   1

Definition at line 33 of file qexpected_p.h.

◆ TL_EXPECTED_VERSION_MINOR

#define TL_EXPECTED_VERSION_MINOR   1

Definition at line 34 of file qexpected_p.h.

◆ TL_EXPECTED_VERSION_PATCH

#define TL_EXPECTED_VERSION_PATCH   0

Definition at line 35 of file qexpected_p.h.

◆ TL_MONOSTATE_INPLACE_MUTEX

#define TL_MONOSTATE_INPLACE_MUTEX

Definition at line 167 of file qexpected_p.h.

◆ TL_TRAITS_MUTEX

#define TL_TRAITS_MUTEX

Definition at line 262 of file qexpected_p.h.