sparrow 0.3.0
|
Namespaces | |
namespace | impl |
namespace | predicate |
Classes | |
struct | add_const_lvalue_reference |
struct | constify |
struct | constify< T &, is_const > |
struct | ct_type_predicate_to_callable |
struct | dependent_false |
Workaround to replace static_assert(false) in template code. More... | |
struct | excludes_copy_and_move_ctor |
struct | excludes_copy_and_move_ctor< CLS > |
struct | excludes_copy_and_move_ctor< CLS, T > |
struct | is_type_instance_of |
struct | is_type_instance_of< L< T... >, U > |
struct | typelist |
A sequence of types, used for meta-programming operations. More... | |
Concepts | |
concept | any_typelist |
Matches any type which is an instance of typelist . | |
concept | type_wrapper |
Matches template types which can be used as type-wrappers for evaluation in type-predicates. | |
concept | ct_type_predicate |
Matches template types that can be evaluated at compile-time similarly to std::true/false_type This makes possible to use predicates provided by the standard. | |
concept | callable_type_predicate |
Matches types whose instance can be called with an object representing a type to evaluate it. | |
concept | constant_iterator |
Represents a constant iterator. | |
concept | constant_range |
The constant_range concept is a refinement of range for which ranges::begin returns a constant iterator. | |
concept | bool_convertible_range |
Matches range types whose elements are convertible to bool. | |
concept | boolean_like |
Matches types that can be convertible to and assignable from bool. | |
concept | convertible_ranges |
Matches range types From whose elements are convertible to elements of range type To. | |
concept | unique_ptr |
concept | unique_ptr_or_derived |
concept | shared_ptr |
concept | shared_ptr_or_derived |
concept | smart_ptr |
concept | smart_ptr_and_derived |
concept | testable |
concept | T_matches_qualifier_if_Y_is |
concept | iterator_of_type |
Concept to check if an iterator is of a specific type. | |
concept | char_like |
concept | std_array |
concept | fixed_size_span |
Typedefs | |
template<class TypeList, class... Us> | |
using | append_t = decltype(append(TypeList{}, Us{}...)) |
Appends one or more types or typelist to a given TypeList. | |
template<class From, template< class... > class To> | |
using | rename = typename impl::rename_impl<From, To>::type |
Changes the type of the list to the given type/ Example: static_assert(std::same_as<rename<typelist<int, float>, std::variant>, std::variant<int, float>>) | |
template<template< class > class F, class... L> | |
using | transform = typename impl::transform_impl<F, L...>::type |
Applies the metafunction F to each tuple of elements in the typelists and returns the corresponding list Example: transform<std::add_pointer_t, typelist<int, float> gives typelist<int*, float*> transform<std::is_same, typelist<int, float>, typelist<int, int>> gives typelist<std::is_same<int, int>, std::is_same<float, int>> | |
template<class T> | |
using | add_const_lvalue_reference_t = typename add_const_lvalue_reference<T>::type |
template<class T, bool is_const> | |
using | constify_t = typename constify<T, is_const>::type |
template<class T> | |
using | iter_const_reference_t = std::common_reference_t<const std::iter_value_t<T>&&, std::iter_reference_t<T>> |
Computes the const reference type of T. | |
Functions | |
template<class... Ts, class... Us> requires (!is_type_instance_of_v<Us, typelist> && ...) | |
consteval auto | append (typelist< Ts... >, Us...) |
Appends the given types to a typelist. | |
template<class... Ts, class... Us> | |
consteval auto | append (typelist< Ts... >, typelist< Us... >) |
Appends two typelists together. | |
template<class... T> | |
constexpr std::size_t | size (typelist< T... >={}) |
template<class T, template< class > class P> requires ct_type_predicate<P, T> | |
consteval bool | evaluate (P< T >) |
Evaluates the provided compile-time template class predicate P given a type T, if P is of a similar shape to std::true/false_type . | |
template<class T, callable_type_predicate< T > P> | |
consteval bool | evaluate (P predicate) |
Evaluates the provided compile-time template class predicate P given a type T, if P's instance is callable given a value type wrapper of T. | |
template<template< class > class P> | |
consteval auto | as_predicate () |
template<class Predicate, template< class... > class L, class... T> requires any_typelist<L<T...>> and (callable_type_predicate<Predicate, T> && ...) | |
consteval bool | any_of (L< T... >, Predicate predicate={}) |
Checks that at least one type in the provided list of is making the provide predicate return true . | |
template<template< class > class Predicate, template< class... > class L, class... T> requires any_typelist<L<T...>> and (ct_type_predicate<Predicate, T> && ...) | |
consteval bool | any_of (L< T... > list) |
Checks that at least one type in the provided list of is making the provide predicate return true . | |
template<class Predicate, template< class... > class L, class... T> requires any_typelist<L<T...>> and (callable_type_predicate<Predicate, T> && ...) | |
consteval bool | all_of (L< T... >, Predicate predicate) |
Checks that every type in the provided list of is making the provide predicate return true . | |
template<template< class > class Predicate, template< class... > class L, class... T> requires any_typelist<L<T...>> and (ct_type_predicate<Predicate, T> && ...) | |
consteval bool | all_of (L< T... > list) |
Checks that every type in the provided list of is making the provide predicate return true . | |
template<class V, any_typelist L> | |
consteval bool | contains (L list) |
template<class Predicate, template< class... > class L, class... T> requires any_typelist<L<T...>> and (callable_type_predicate<Predicate, T> && ...) | |
consteval std::size_t | find_if (L< T... >, Predicate predicate) |
template<template< class > class Predicate, template< class... > class L, class... T> requires any_typelist<L<T...>> and (ct_type_predicate<Predicate, T> && ...) | |
consteval std::size_t | find_if (L< T... > list) |
template<class TypeToFind, any_typelist L> | |
consteval std::size_t | find (L list) |
void | unreachable () |
Invokes undefined behavior. | |
template<typename T> | |
constexpr bool | is_reference_wrapper (const T &) |
Checks if the given type is a reference wrapper. | |
Variables | |
template<class T, template< class... > class U> | |
constexpr bool | is_type_instance_of_v = is_type_instance_of<T, U>::value |
true if T is a concrete type template instanciation of U which is a type template. | |
template<class CLS, class... ARGS> | |
constexpr bool | excludes_copy_and_move_ctor_v = excludes_copy_and_move_ctor<CLS, ARGS...>::value |
template<typename T> | |
constexpr bool | is_reference_wrapper_v = false |
template<typename U> | |
constexpr bool | is_reference_wrapper_v< std::reference_wrapper< U > > = true |
using sparrow::mpl::add_const_lvalue_reference_t = typename add_const_lvalue_reference<T>::type |
Definition at line 373 of file mp_utils.hpp.
using sparrow::mpl::append_t = decltype(append(TypeList{}, Us{}...)) |
Appends one or more types or typelist to a given TypeList.
This template alias takes a TypeList and one or more types or typelist as template arguments. It appends the types to the given TypeList and returns the resulting TypeList.
TypeList | The TypeList to which the types will be appended. |
Us | The types or typelists to be appended to the TypeList. |
Definition at line 103 of file mp_utils.hpp.
using sparrow::mpl::constify_t = typename constify<T, is_const>::type |
Definition at line 390 of file mp_utils.hpp.
using sparrow::mpl::iter_const_reference_t = std::common_reference_t<const std::iter_value_t<T>&&, std::iter_reference_t<T>> |
Computes the const reference type of T.
T | The const reference type of T. |
Definition at line 396 of file mp_utils.hpp.
using sparrow::mpl::rename = typename impl::rename_impl<From, To>::type |
Changes the type of the list to the given type/ Example: static_assert(std::same_as<rename<typelist<int, float>, std::variant>, std::variant<int, float>>)
Definition at line 135 of file mp_utils.hpp.
using sparrow::mpl::transform = typename impl::transform_impl<F, L...>::type |
Applies the metafunction F to each tuple of elements in the typelists and returns the corresponding list Example: transform<std::add_pointer_t, typelist<int, float> gives typelist<int*, float*> transform<std::is_same, typelist<int, float>, typelist<int, int>> gives typelist<std::is_same<int, int>, std::is_same<float, int>>
Definition at line 362 of file mp_utils.hpp.
|
nodiscardconsteval |
Checks that every type in the provided list of is making the provide predicate return true
.
true
if for every type T in the type list L, Predicate<T>::value == true
or if the list is empty; false
otherwise. Definition at line 278 of file mp_utils.hpp.
|
nodiscardconsteval |
Checks that every type in the provided list of is making the provide predicate return true
.
true
if for every type T in the type list L, Predicate{}(typelist<T>) == true
or if the list is empty; false
otherwise. Definition at line 264 of file mp_utils.hpp.
|
nodiscardconsteval |
Checks that at least one type in the provided list of is making the provide predicate return true
.
Predicate<T>::value == true
. false
otherwise or if the list is empty. Definition at line 254 of file mp_utils.hpp.
|
nodiscardconsteval |
Checks that at least one type in the provided list of is making the provide predicate return true
.
Predicate{}(typelist<T>) == true
. false
otherwise or if the list is empty. Definition at line 244 of file mp_utils.hpp.
|
consteval |
Appends two typelists together.
This function takes two typelists as input and returns a new typelist that contains all the types from both input typelists.
Ts... | The types in the first typelist. |
Us... | The types in the second typelist. |
list1 | The first typelist. |
list2 | The second typelist. |
Definition at line 87 of file mp_utils.hpp.
|
consteval |
Appends the given types to a typelist.
This function takes a typelist and additional types as arguments, and returns a new typelist that contains all the types from the original typelist followed by the additional types.
Ts... | The types in the original typelist. |
Us... | The additional types to be appended. |
typelist<Ts...> | The original typelist. |
Us... | The additional types. |
Definition at line 71 of file mp_utils.hpp.
|
consteval |
P<T>::value
when called with T
in a type-wrapper. Definition at line 231 of file mp_utils.hpp.
|
nodiscardconsteval |
true
if the provided type list contains V
Definition at line 285 of file mp_utils.hpp.
|
nodiscardconsteval |
Evaluates the provided compile-time template class predicate P given a type T, if P's instance is callable given a value type wrapper of T.
Definition at line 182 of file mp_utils.hpp.
|
consteval |
Evaluates the provided compile-time template class predicate P given a type T, if P is of a similar shape to std::true/false_type
.
Definition at line 174 of file mp_utils.hpp.
|
nodiscardconsteval |
TypeToFind
in the provided type list L
, or the size of the list if the matching type was not found. Definition at line 329 of file mp_utils.hpp.
|
nodiscardconsteval |
L
that matches the provided predicate, or the size of the list if the matching type was not found. Definition at line 321 of file mp_utils.hpp.
|
nodiscardconsteval |
L
that matches the provided predicate, or the size of the list if the matching type was not found. Definition at line 295 of file mp_utils.hpp.
|
nodiscardconstexpr |
Checks if the given type is a reference wrapper.
T | The type to check. |
The | instance of the type to check. |
true
if the type is a reference wrapper, false
otherwise. Definition at line 66 of file reference_wrapper_utils.hpp.
|
constexpr |
typelist
. Definition at line 107 of file mp_utils.hpp.
|
inline |
Invokes undefined behavior.
An implementation may use this to optimize impossible code branches away (typically, in optimized builds) or to trap them to prevent further execution (typically, in debug builds).
Definition at line 425 of file mp_utils.hpp.
|
constexpr |
Definition at line 507 of file mp_utils.hpp.
|
constexpr |
Definition at line 55 of file reference_wrapper_utils.hpp.
|
constexpr |
Definition at line 58 of file reference_wrapper_utils.hpp.
|
constexpr |
true
if T
is a concrete type template instanciation of U
which is a type template.
Example: is_type_instance_of_v< std::vector<int>, std::vector > == true
Definition at line 50 of file mp_utils.hpp.