WPILibC++ 2024.3.2
wpi::detail Namespace Reference

Namespaces

namespace  swap_adl_tests
 

Classes

class  AllocatorHolder
 
class  AllocatorHolder< Alloc & >
 
struct  conjunction
 
struct  conjunction< B >
 
struct  conjunction< B, Bs... >
 
struct  ConstantLog2
 A tiny meta function to compute the log2 of a compile time constant. More...
 
struct  ConstantLog2< 1 >
 
struct  default_constructor_tag
 
struct  DenseMapPair
 
struct  expected_copy_assign_base
 
struct  expected_copy_assign_base< T, E, false >
 
struct  expected_copy_base
 
struct  expected_copy_base< T, E, false >
 
struct  expected_default_ctor_base
 
struct  expected_default_ctor_base< T, E, false >
 
struct  expected_delete_assign_base
 
struct  expected_delete_assign_base< T, E, false, false >
 
struct  expected_delete_assign_base< T, E, false, true >
 
struct  expected_delete_assign_base< T, E, true, false >
 
struct  expected_delete_ctor_base
 
struct  expected_delete_ctor_base< T, E, false, false >
 
struct  expected_delete_ctor_base< T, E, false, true >
 
struct  expected_delete_ctor_base< T, E, true, false >
 
struct  expected_move_assign_base
 
struct  expected_move_assign_base< T, E, false >
 
struct  expected_move_base
 
struct  expected_move_base< T, E, false >
 
struct  expected_operations_base
 
struct  expected_operations_base< void, E >
 
struct  expected_storage_base
 
struct  expected_storage_base< T, E, false, true >
 
struct  expected_storage_base< T, E, true, false >
 
struct  expected_storage_base< T, E, true, true >
 
struct  expected_storage_base< void, E, false, false >
 
struct  expected_storage_base< void, E, false, true >
 
struct  FutureThen
 
struct  FutureThen< To, void >
 
struct  FutureThen< void, From >
 
struct  FutureThen< void, void >
 
struct  HasPointerLikeTypeTraits
 
struct  HasPointerLikeTypeTraits< T, decltype((sizeof(PointerLikeTypeTraits< T >)+sizeof(T)), void())>
 
struct  invoke_result_impl
 
struct  invoke_result_impl< F, decltype(detail::invoke(std::declval< F >(), std::declval< Us >()...), void()), Us... >
 
struct  is_expected_impl
 
struct  is_expected_impl< expected< T, E > >
 
struct  is_nothrow_swappable
 
struct  is_swappable
 
struct  is_swappable< T[N], T[N]>
 
struct  IsPointerLike
 
struct  IsPointerLike< T * >
 
struct  no_init_t
 
class  PromiseFactoryBase
 
struct  PunnedPointer
 
class  SafeThreadOwnerBase
 Non-template owner base class for common owner code. More...
 
class  SafeThreadProxy
 A proxy for SafeThread. More...
 
class  SafeThreadProxyBase
 Non-template proxy base class for common proxy code. More...
 
struct  TC
 
union  trivial_helper
 
struct  TypesAreDistinct
 
struct  TypesAreDistinct< T >
 
class  UniqueFunctionBase
 
struct  WorkerThreadAsync
 
struct  WorkerThreadAsync< void >
 
struct  WorkerThreadRequest
 
class  WorkerThreadThread
 

Typedefs

template<class T >
using remove_const_t = typename std::remove_const< T >::type
 
template<class T >
using remove_reference_t = typename std::remove_reference< T >::type
 
template<class T >
using decay_t = typename std::decay< T >::type
 
template<bool E, class T = void>
using enable_if_t = typename std::enable_if< E, T >::type
 
template<bool B, class T , class F >
using conditional_t = typename std::conditional< B, T, F >::type
 
template<class F , class... Us>
using invoke_result = invoke_result_impl< F, void, Us... >
 
template<class F , class... Us>
using invoke_result_t = typename invoke_result< F, Us... >::type
 
template<class T >
using is_expected = is_expected_impl< decay_t< T > >
 
template<class T , class E , class U >
using 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 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 is_void_or = conditional_t< std::is_void< T >::value, std::true_type, U >
 
template<class T >
using is_copy_constructible_or_void = is_void_or< T, std::is_copy_constructible< T > >
 
template<class T >
using is_move_constructible_or_void = is_void_or< T, std::is_move_constructible< T > >
 
template<class T >
using is_copy_assignable_or_void = is_void_or< T, std::is_copy_assignable< T > >
 
template<class T >
using is_move_assignable_or_void = is_void_or< T, std::is_move_assignable< T > >
 
template<class Exp >
using exp_t = typename detail::decay_t< Exp >::value_type
 
template<class Exp >
using err_t = typename detail::decay_t< Exp >::error_type
 
template<class Exp , class Ret >
using ret_t = expected< Ret, err_t< Exp > >
 
template<typename OptionalDerived , typename Default >
using SelfType = std::conditional_t< std::is_same_v< OptionalDerived, void >, Default, OptionalDerived >
 A helper to derive the type to use with Self for cast traits, when the provided CRTP derived type is allowed to be void. More...
 
template<typename RangeT >
using IterOfRange = decltype(adl_begin(std::declval< RangeT & >()))
 
template<typename RangeT >
using ValueOfRange = std::remove_reference_t< decltype(*adl_begin(std::declval< RangeT & >()))>
 
template<typename T >
using EnableIfTrivial = std::enable_if_t< std::is_trivially_move_constructible< T >::value &&std::is_trivially_destructible< T >::value >
 
template<typename CallableT , typename ThisT >
using EnableUnlessSameType = std::enable_if_t<!std::is_same< remove_cvref_t< CallableT >, ThisT >::value >
 
template<typename CallableT , typename Ret , typename... Params>
using EnableIfCallable = std::enable_if_t< std::disjunction< std::is_void< Ret >, std::is_same< decltype(std::declval< CallableT >()(std::declval< Params >()...)), Ret >, std::is_same< const decltype(std::declval< CallableT >()(std::declval< Params >()...)), Ret >, std::is_convertible< decltype(std::declval< CallableT >()(std::declval< Params >()...)), Ret > >::value >
 

Functions

template<typename R , typename... T>
void RunWorkerThreadRequest (WorkerThreadThread< R, T... > &thr, WorkerThreadRequest< R, T... > &req)
 
template<typename... T>
void RunWorkerThreadRequest (WorkerThreadThread< void, T... > &thr, WorkerThreadRequest< void, T... > &req)
 
void DeleteProtobuf (google::protobuf::Message *msg)
 
bool ParseProtobuf (google::protobuf::Message *msg, std::span< const uint8_t > data)
 
bool SerializeProtobuf (wpi::SmallVectorImpl< uint8_t > &out, const google::protobuf::Message &msg)
 
bool SerializeProtobuf (std::vector< uint8_t > &out, const google::protobuf::Message &msg)
 
std::string GetTypeString (const google::protobuf::Message &msg)
 
void ForEachProtobufDescriptor (const google::protobuf::Message &msg, function_ref< bool(std::string_view filename)> wants, function_ref< void(std::string_view filename, std::span< const uint8_t > descriptor)> fn)
 
void swap (SafeThreadOwnerBase &lhs, SafeThreadOwnerBase &rhs) noexcept
 
template<typename E >
WPI_EXPECTED_11_CONSTEXPR void 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 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 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 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 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 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 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 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 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 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 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 > or_else_impl (Exp &&exp, F &&f)
 
template<typename T >
bool isPresent (const T &t)
 
template<typename T >
decltype(auto) unwrapValue (T &t)
 
static unsigned combineHashValue (unsigned a, unsigned b)
 Simplistic combination of 32-bit hash values into 32-bit hash values. More...
 
bool GetAsUnsignedInteger (std::string_view str, unsigned radix, unsigned long long &result) noexcept
 
bool GetAsSignedInteger (std::string_view str, unsigned radix, long long &result) noexcept
 
bool ConsumeUnsignedInteger (std::string_view &str, unsigned radix, unsigned long long &result) noexcept
 
bool ConsumeSignedInteger (std::string_view &str, unsigned radix, long long &result) noexcept
 

Variables

static constexpr no_init_t no_init {}
 

Typedef Documentation

◆ conditional_t

template<bool B, class T , class F >
using wpi::detail::conditional_t = typedef typename std::conditional<B, T, F>::type

◆ decay_t

template<class T >
using wpi::detail::decay_t = typedef typename std::decay<T>::type

◆ enable_if_t

template<bool E, class T = void>
using wpi::detail::enable_if_t = typedef typename std::enable_if<E, T>::type

◆ EnableIfCallable

template<typename CallableT , typename Ret , typename... Params>
using wpi::detail::EnableIfCallable = typedef std::enable_if_t<std::disjunction< std::is_void<Ret>, std::is_same<decltype(std::declval<CallableT>()(std::declval<Params>()...)), Ret>, std::is_same<const decltype(std::declval<CallableT>()( std::declval<Params>()...)), Ret>, std::is_convertible<decltype(std::declval<CallableT>()( std::declval<Params>()...)), Ret> >::value>

◆ EnableIfTrivial

template<typename T >
using wpi::detail::EnableIfTrivial = typedef std::enable_if_t<std::is_trivially_move_constructible<T>::value && std::is_trivially_destructible<T>::value>

◆ EnableUnlessSameType

template<typename CallableT , typename ThisT >
using wpi::detail::EnableUnlessSameType = typedef std::enable_if_t<!std::is_same<remove_cvref_t<CallableT>, ThisT>::value>

◆ err_t

template<class Exp >
using wpi::detail::err_t = typedef typename detail::decay_t<Exp>::error_type

◆ exp_t

template<class Exp >
using wpi::detail::exp_t = typedef typename detail::decay_t<Exp>::value_type

◆ expected_enable_forward_value

template<class T , class E , class U >
using wpi::detail::expected_enable_forward_value = typedef 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>

◆ expected_enable_from_other

template<class T , class E , class U , class G , class UR , class GR >
using wpi::detail::expected_enable_from_other = typedef 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>

◆ invoke_result

template<class F , class... Us>
using wpi::detail::invoke_result = typedef invoke_result_impl<F, void, Us...>

◆ invoke_result_t

template<class F , class... Us>
using wpi::detail::invoke_result_t = typedef typename invoke_result<F, Us...>::type

◆ is_copy_assignable_or_void

template<class T >
using wpi::detail::is_copy_assignable_or_void = typedef is_void_or<T, std::is_copy_assignable<T> >

◆ is_copy_constructible_or_void

template<class T >
using wpi::detail::is_copy_constructible_or_void = typedef is_void_or<T, std::is_copy_constructible<T> >

◆ is_expected

template<class T >
using wpi::detail::is_expected = typedef is_expected_impl<decay_t<T> >

◆ is_move_assignable_or_void

template<class T >
using wpi::detail::is_move_assignable_or_void = typedef is_void_or<T, std::is_move_assignable<T> >

◆ is_move_constructible_or_void

template<class T >
using wpi::detail::is_move_constructible_or_void = typedef is_void_or<T, std::is_move_constructible<T> >

◆ is_void_or

template<class T , class U >
using wpi::detail::is_void_or = typedef conditional_t<std::is_void<T>::value, std::true_type, U>

◆ IterOfRange

template<typename RangeT >
using wpi::detail::IterOfRange = typedef decltype(adl_begin(std::declval<RangeT &>()))

◆ remove_const_t

template<class T >
using wpi::detail::remove_const_t = typedef typename std::remove_const<T>::type

◆ remove_reference_t

template<class T >
using wpi::detail::remove_reference_t = typedef typename std::remove_reference<T>::type

◆ ret_t

template<class Exp , class Ret >
using wpi::detail::ret_t = typedef expected<Ret, err_t<Exp> >

◆ SelfType

template<typename OptionalDerived , typename Default >
using wpi::detail::SelfType = typedef std::conditional_t<std::is_same_v<OptionalDerived, void>, Default, OptionalDerived>

A helper to derive the type to use with Self for cast traits, when the provided CRTP derived type is allowed to be void.

◆ ValueOfRange

template<typename RangeT >
using wpi::detail::ValueOfRange = typedef std::remove_reference_t<decltype(*adl_begin(std::declval<RangeT &>()))>

Function Documentation

◆ and_then_impl() [1/2]

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

◆ and_then_impl() [2/2]

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
constexpr

◆ combineHashValue()

static unsigned wpi::detail::combineHashValue ( unsigned  a,
unsigned  b 
)
inlinestatic

Simplistic combination of 32-bit hash values into 32-bit hash values.

◆ ConsumeSignedInteger()

bool wpi::detail::ConsumeSignedInteger ( std::string_view str,
unsigned  radix,
long long &  result 
)
noexcept

◆ ConsumeUnsignedInteger()

bool wpi::detail::ConsumeUnsignedInteger ( std::string_view str,
unsigned  radix,
unsigned long long &  result 
)
noexcept

◆ DeleteProtobuf()

void wpi::detail::DeleteProtobuf ( google::protobuf::Message *  msg)

◆ expected_map_impl() [1/2]

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>>

◆ expected_map_impl() [2/2]

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>>
constexpr

◆ ForEachProtobufDescriptor()

void wpi::detail::ForEachProtobufDescriptor ( const google::protobuf::Message &  msg,
function_ref< bool(std::string_view filename)>  wants,
function_ref< void(std::string_view filename, std::span< const uint8_t > descriptor)>  fn 
)

◆ GetAsSignedInteger()

bool wpi::detail::GetAsSignedInteger ( std::string_view  str,
unsigned  radix,
long long &  result 
)
noexcept

◆ GetAsUnsignedInteger()

bool wpi::detail::GetAsUnsignedInteger ( std::string_view  str,
unsigned  radix,
unsigned long long &  result 
)
noexcept

◆ GetTypeString()

std::string wpi::detail::GetTypeString ( const google::protobuf::Message &  msg)

◆ invoke() [1/2]

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 
) -> decltype(std::forward<Fn>(f)(std::forward<Args>(args)...))
constexprnoexcept

◆ invoke() [2/2]

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 
) -> decltype(std::mem_fn(f)(std::forward<Args>(args)...))
constexprnoexcept

◆ isPresent()

template<typename T >
bool wpi::detail::isPresent ( const T &  t)
inline

◆ map_error_impl() [1/2]

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>>
constexpr

◆ map_error_impl() [2/2]

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>

◆ or_else_impl() [1/2]

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 
)

◆ or_else_impl() [2/2]

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

◆ ParseProtobuf()

bool wpi::detail::ParseProtobuf ( google::protobuf::Message *  msg,
std::span< const uint8_t >  data 
)

◆ RunWorkerThreadRequest() [1/2]

template<typename R , typename... T>
void wpi::detail::RunWorkerThreadRequest ( WorkerThreadThread< R, T... > &  thr,
WorkerThreadRequest< R, T... > &  req 
)

◆ RunWorkerThreadRequest() [2/2]

template<typename... T>
void wpi::detail::RunWorkerThreadRequest ( WorkerThreadThread< void, T... > &  thr,
WorkerThreadRequest< void, T... > &  req 
)

◆ SerializeProtobuf() [1/2]

bool wpi::detail::SerializeProtobuf ( std::vector< uint8_t > &  out,
const google::protobuf::Message &  msg 
)

◆ SerializeProtobuf() [2/2]

bool wpi::detail::SerializeProtobuf ( wpi::SmallVectorImpl< uint8_t > &  out,
const google::protobuf::Message &  msg 
)

◆ swap()

void wpi::detail::swap ( SafeThreadOwnerBase lhs,
SafeThreadOwnerBase rhs 
)
noexcept

◆ throw_exception()

template<typename E >
WPI_EXPECTED_11_CONSTEXPR void wpi::detail::throw_exception ( E &&  e)

◆ unwrapValue()

template<typename T >
decltype(auto) wpi::detail::unwrapValue ( T &  t)
inline

Variable Documentation

◆ no_init

constexpr no_init_t wpi::detail::no_init {}
staticconstexpr