WPILibC++ 2024.3.2
expected File Reference
#include <exception>
#include <functional>
#include <type_traits>
#include <utility>

Classes

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

Macros

#define WPI_EXPECTED_HPP
 
#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)    std::is_trivially_copy_constructible<T>
 
#define WPI_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE(T)    std::is_trivially_copy_assignable<T>
 
#define WPI_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE(T)    std::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::remove_const_t = typename std::remove_const< T >::type
 
template<class T >
using wpi::detail::remove_reference_t = typename std::remove_reference< T >::type
 
template<class T >
using wpi::detail::decay_t = typename std::decay< T >::type
 
template<bool E, class T = void>
using wpi::detail::enable_if_t = typename std::enable_if< E, T >::type
 
template<bool B, class T , class F >
using wpi::detail::conditional_t = typename std::conditional< B, T, F >::type
 
template<class F , class... Us>
using wpi::detail::invoke_result = invoke_result_impl< F, void, Us... >
 
template<class F , class... Us>
using wpi::detail::invoke_result_t = typename invoke_result< F, Us... >::type
 
template<class T >
using wpi::detail::is_expected = is_expected_impl< decay_t< T > >
 
template<class T , class E , class U >
using wpi::detail::expected_enable_forward_value = detail::enable_if_t< std::is_constructible< T, U && >::value &&!std::is_same< detail::decay_t< U >, in_place_t >::value &&!std::is_same< expected< T, E >, detail::decay_t< U > >::value &&!std::is_same< unexpected< E >, detail::decay_t< U > >::value >
 
template<class T , class E , class U , class G , class UR , class GR >
using wpi::detail::expected_enable_from_other = detail::enable_if_t< std::is_constructible< T, UR >::value &&std::is_constructible< E, GR >::value &&!std::is_constructible< T, expected< U, G > & >::value &&!std::is_constructible< T, expected< U, G > && >::value &&!std::is_constructible< T, const expected< U, G > & >::value &&!std::is_constructible< T, const expected< U, G > && >::value &&!std::is_convertible< expected< U, G > &, T >::value &&!std::is_convertible< expected< U, G > &&, T >::value &&!std::is_convertible< const expected< U, G > &, T >::value &&!std::is_convertible< const expected< U, G > &&, T >::value >
 
template<class T , class U >
using wpi::detail::is_void_or = conditional_t< std::is_void< T >::value, std::true_type, U >
 
template<class T >
using wpi::detail::is_copy_constructible_or_void = is_void_or< T, std::is_copy_constructible< T > >
 
template<class T >
using wpi::detail::is_move_constructible_or_void = is_void_or< T, std::is_move_constructible< T > >
 
template<class T >
using wpi::detail::is_copy_assignable_or_void = is_void_or< T, std::is_copy_assignable< T > >
 
template<class T >
using wpi::detail::is_move_assignable_or_void = is_void_or< T, std::is_move_assignable< T > >
 
template<class Exp >
using wpi::detail::exp_t = typename detail::decay_t< Exp >::value_type
 
template<class Exp >
using wpi::detail::err_t = typename detail::decay_t< Exp >::error_type
 
template<class Exp , class Ret >
using wpi::detail::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::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::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::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::swap_adl_tests::swap (T &, T &)
 
template<class T , std::size_t N>
tag wpi::detail::swap_adl_tests::swap (T(&a)[N], T(&b)[N])
 
template<class , class >
std::false_type wpi::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 wpi::detail::swap_adl_tests::can_swap (int) noexcept(noexcept(swap(std::declval< T & >(), std::declval< U & >())))
 
template<class , class >
std::false_type wpi::detail::swap_adl_tests::uses_std (...)
 
template<class T , class U >
std::is_same< decltype(swap(std::declval< T & >(), std::declval< U & >())), tag > wpi::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 wpi::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 wpi::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 wpi::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 wpi::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 wpi::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 wpi::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 wpi::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 > wpi::detail::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::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 wpi::swap (expected< T, E > &lhs, expected< T, E > &rhs) noexcept(noexcept(lhs.swap(rhs)))
 

Variables

static constexpr no_init_t wpi::detail::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_HPP

#define WPI_EXPECTED_HPP

◆ WPI_EXPECTED_IS_TRIVIALLY_COPY_ASSIGNABLE

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

◆ WPI_EXPECTED_IS_TRIVIALLY_COPY_CONSTRUCTIBLE

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

◆ WPI_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE

#define WPI_EXPECTED_IS_TRIVIALLY_DESTRUCTIBLE (   T)     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