WPILibC++ 2025.3.1
Loading...
Searching...
No Matches
expected File Reference
#include <exception>
#include <functional>
#include <type_traits>
#include <utility>

Go to the source code of this file.

Classes

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

Namespaces

namespace  wpi
 Foonathan namespace.
 
namespace  wpi::detail_expected
 
namespace  wpi::detail_expected::swap_adl_tests
 

Macros

#define WPI_EXPECTED_VERSION_MAJOR   1
 
#define WPI_EXPECTED_VERSION_MINOR   1
 
#define WPI_EXPECTED_VERSION_PATCH   0
 
#define WPI_EXPECTED_MSVC2015_CONSTEXPR   constexpr
 
#define WPI_ASSERT(x)
 
#define WPI_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T)
 
#define WPI_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(T)
 
#define WPI_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(T)
 
#define WPI_EXPECTED_GCC49_CONSTEXPR   constexpr
 
#define WPI_EXPECTED_11_CONSTEXPR   constexpr
 
#define WPI_MONOSTATE_INPLACE_MUTEX
 
#define WPI_TRAITS_MUTEX
 

Typedefs

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

Functions

template<class E >
constexpr bool wpi::operator== (const unexpected< E > &lhs, const unexpected< E > &rhs)
 
template<class E >
constexpr bool wpi::operator!= (const unexpected< E > &lhs, const unexpected< E > &rhs)
 
template<class E >
constexpr bool wpi::operator< (const unexpected< E > &lhs, const unexpected< E > &rhs)
 
template<class E >
constexpr bool wpi::operator<= (const unexpected< E > &lhs, const unexpected< E > &rhs)
 
template<class E >
constexpr bool wpi::operator> (const unexpected< E > &lhs, const unexpected< E > &rhs)
 
template<class E >
constexpr bool wpi::operator>= (const unexpected< E > &lhs, const unexpected< E > &rhs)
 
template<class E >
unexpected< typename std::decay< E >::type > wpi::make_unexpected (E &&e)
 
template<typename E >
WPI_EXPECTED_11_CONSTEXPR void wpi::detail_expected::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 wpi::detail_expected::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 wpi::detail_expected::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 wpi::detail_expected::swap_adl_tests::swap (T &, T &)
 
template<class T , std::size_t N>
tag wpi::detail_expected::swap_adl_tests::swap (T(&a)[N], T(&b)[N])
 
template<class , class >
std::false_type wpi::detail_expected::swap_adl_tests::can_swap (...) noexcept(false)
 
template<class T , class U , class = decltype(swap(std::declval<T &>(), std::declval<U &>()))>
std::true_type wpi::detail_expected::swap_adl_tests::can_swap (int) noexcept(noexcept(swap(std::declval< T & >(), std::declval< U & >())))
 
template<class , class >
std::false_type wpi::detail_expected::swap_adl_tests::uses_std (...)
 
template<class T , class U >
std::is_same< decltype(swap(std::declval< T & >(), std::declval< U & >())), tagwpi::detail_expected::swap_adl_tests::uses_std (int)
 
template<class Exp , class F , class Ret = decltype(detail_expected::invoke(std::declval<F>(), *std::declval<Exp>())), detail_expected::enable_if_t<!std::is_void< exp_t< Exp > >::value > * = nullptr>
auto wpi::detail_expected::and_then_impl (Exp &&exp, F &&f) -> Ret
 
template<class Exp , class F , class Ret = decltype(detail_expected::invoke(std::declval<F>())), detail_expected::enable_if_t< std::is_void< exp_t< Exp > >::value > * = nullptr>
constexpr auto wpi::detail_expected::and_then_impl (Exp &&exp, F &&f) -> Ret
 
template<class Exp , class F , detail_expected::enable_if_t<!std::is_void< exp_t< Exp > >::value > * = nullptr, class Ret = decltype(detail_expected::invoke(std::declval<F>(), *std::declval<Exp>())), detail_expected::enable_if_t<!std::is_void< Ret >::value > * = nullptr>
constexpr auto wpi::detail_expected::expected_map_impl (Exp &&exp, F &&f) -> ret_t< Exp, detail_expected::decay_t< Ret > >
 
template<class Exp , class F , detail_expected::enable_if_t<!std::is_void< exp_t< Exp > >::value > * = nullptr, class Ret = decltype(detail_expected::invoke(std::declval<F>(), *std::declval<Exp>())), detail_expected::enable_if_t< std::is_void< Ret >::value > * = nullptr>
auto wpi::detail_expected::expected_map_impl (Exp &&exp, F &&f) -> expected< void, err_t< Exp > >
 
template<class Exp , class F , detail_expected::enable_if_t<!std::is_void< exp_t< Exp > >::value > * = nullptr, class Ret = decltype(detail_expected::invoke(std::declval<F>(), std::declval<Exp>().error())), detail_expected::enable_if_t<!std::is_void< Ret >::value > * = nullptr>
constexpr auto wpi::detail_expected::map_error_impl (Exp &&exp, F &&f) -> expected< exp_t< Exp >, detail_expected::decay_t< Ret > >
 
template<class Exp , class F , detail_expected::enable_if_t<!std::is_void< exp_t< Exp > >::value > * = nullptr, class Ret = decltype(detail_expected::invoke(std::declval<F>(), std::declval<Exp>().error())), detail_expected::enable_if_t< std::is_void< Ret >::value > * = nullptr>
auto wpi::detail_expected::map_error_impl (Exp &&exp, F &&f) -> expected< exp_t< Exp >, monostate >
 
template<class Exp , class F , class Ret = decltype(detail_expected::invoke(std::declval<F>(), std::declval<Exp>().error())), detail_expected::enable_if_t<!std::is_void< Ret >::value > * = nullptr>
auto wpi::detail_expected::or_else_impl (Exp &&exp, F &&f) -> Ret
 
template<class Exp , class F , class Ret = decltype(detail_expected::invoke(std::declval<F>(), std::declval<Exp>().error())), detail_expected::enable_if_t< std::is_void< Ret >::value > * = nullptr>
detail_expected::decay_t< Exp > wpi::detail_expected::or_else_impl (Exp &&exp, F &&f)
 
template<class T , class E , class U , class F >
constexpr bool wpi::operator== (const expected< T, E > &lhs, const expected< U, F > &rhs)
 
template<class T , class E , class U , class F >
constexpr bool wpi::operator!= (const expected< T, E > &lhs, const expected< U, F > &rhs)
 
template<class E , class F >
constexpr bool wpi::operator== (const expected< void, E > &lhs, const expected< void, F > &rhs)
 
template<class E , class F >
constexpr bool wpi::operator!= (const expected< void, E > &lhs, const expected< void, F > &rhs)
 
template<class T , class E , class U >
constexpr bool wpi::operator== (const expected< T, E > &x, const U &v)
 
template<class T , class E , class U >
constexpr bool wpi::operator== (const U &v, const expected< T, E > &x)
 
template<class T , class E , class U >
constexpr bool wpi::operator!= (const expected< T, E > &x, const U &v)
 
template<class T , class E , class U >
constexpr bool wpi::operator!= (const U &v, const expected< T, E > &x)
 
template<class T , class E >
constexpr bool wpi::operator== (const expected< T, E > &x, const unexpected< E > &e)
 
template<class T , class E >
constexpr bool wpi::operator== (const unexpected< E > &e, const expected< T, E > &x)
 
template<class T , class E >
constexpr bool wpi::operator!= (const expected< T, E > &x, const unexpected< E > &e)
 
template<class T , class E >
constexpr bool wpi::operator!= (const unexpected< E > &e, const expected< T, E > &x)
 
template<class T , class E , detail_expected::enable_if_t<(std::is_void< T >::value||std::is_move_constructible< T >::value) &&detail_expected::is_swappable< T >::value &&std::is_move_constructible< E >::value &&detail_expected::is_swappable< E >::value > * = nullptr>
void wpi::swap (expected< T, E > &lhs, expected< T, E > &rhs) noexcept(noexcept(lhs.swap(rhs)))
 

Variables

static constexpr in_place_t wpi::in_place {}
 
static constexpr unexpect_t wpi::unexpect {}
 
static constexpr no_init_t wpi::detail_expected::no_init {}
 

Macro Definition Documentation

◆ WPI_ASSERT

#define WPI_ASSERT ( x)

◆ WPI_EXPECTED_11_CONSTEXPR

#define WPI_EXPECTED_11_CONSTEXPR   constexpr

◆ WPI_EXPECTED_GCC49_CONSTEXPR

#define WPI_EXPECTED_GCC49_CONSTEXPR   constexpr

◆ WPI_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE

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

◆ WPI_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE

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

◆ WPI_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE

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

◆ WPI_EXPECTED_MSVC2015_CONSTEXPR

#define WPI_EXPECTED_MSVC2015_CONSTEXPR   constexpr

◆ WPI_EXPECTED_VERSION_MAJOR

#define WPI_EXPECTED_VERSION_MAJOR   1

◆ WPI_EXPECTED_VERSION_MINOR

#define WPI_EXPECTED_VERSION_MINOR   1

◆ WPI_EXPECTED_VERSION_PATCH

#define WPI_EXPECTED_VERSION_PATCH   0

◆ WPI_MONOSTATE_INPLACE_MUTEX

#define WPI_MONOSTATE_INPLACE_MUTEX

◆ WPI_TRAITS_MUTEX

#define WPI_TRAITS_MUTEX