sparrow 0.9.0
|
Namespaces | |
namespace | impl |
namespace | predicate |
Classes | |
struct | add_const_lvalue_reference |
Adds const and lvalue reference to a type. More... | |
struct | constify |
Conditionally adds const to a type. More... | |
struct | constify< T &, is_const > |
Specialization for reference types. More... | |
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 |
Helper to exclude copy and move constructors from variadic templates. More... | |
struct | excludes_copy_and_move_ctor< CLS > |
Specialization for no arguments. More... | |
struct | excludes_copy_and_move_ctor< CLS, T > |
Specialization for single argument. More... | |
struct | is_type_instance_of |
Type trait to check if a type is an instantiation of a template. More... | |
struct | is_type_instance_of< L< T... >, U > |
Specialization for matching template instantiations. More... | |
struct | typelist |
A sequence of types used for metaprogramming operations. More... | |
Concepts | |
concept | any_typelist |
Concept that matches any typelist instantiation. | |
concept | type_wrapper |
Concept for template types that can wrap a single type. | |
concept | ct_type_predicate |
Concept for compile-time type predicates. | |
concept | callable_type_predicate |
Concept for callable type predicates. | |
concept | constant_iterator |
Concept for constant iterators. | |
concept | constant_range |
Concept for constant ranges. | |
concept | bool_convertible_range |
Concept for ranges whose elements are convertible to bool. | |
concept | boolean_like |
Concept for boolean-like types. | |
concept | convertible_ranges |
Concept for convertible range types. | |
concept | unique_ptr |
Concept for unique_ptr instances. | |
concept | unique_ptr_or_derived |
Concept for unique_ptr or derived types. | |
concept | shared_ptr |
Concept for shared_ptr instances. | |
concept | shared_ptr_or_derived |
Concept for shared_ptr or derived types. | |
concept | smart_ptr |
Concept for any smart pointer type. | |
concept | smart_ptr_and_derived |
Concept for smart pointers and derived types. | |
concept | testable |
Concept for testable types in boolean contexts. | |
concept | T_matches_qualifier_if_Y_is |
Concept for matching qualifier requirements. | |
concept | iterator_of_type |
Concept for iterators of a specific value type. | |
concept | char_like |
Concept for character-like types. | |
concept | std_array |
Concept for std::array types. | |
concept | weakly_equality_comparable_with |
Typedefs | |
template<class TypeList, class... Us> | |
using | append_t = decltype(append(TypeList{}, Us{}...)) |
Type alias for appending types or typelists to a given typelist. | |
template<class From, template< class... > class To> | |
using | rename = typename impl::rename_impl<From, To>::type |
Changes the template type of a type list. | |
template<template< class > class F, class... L> | |
using | transform = typename impl::transform_impl<F, L...>::type |
Applies a metafunction to each element of typelists. | |
template<class L1, class L2> | |
using | merge_set = typename impl::merge_set_impl<L1, L2>::type |
Generates the union of two typelists, removing duplicates. | |
template<class L> | |
using | unique = typename impl::unique_impl<L>::type |
Removes all duplicated types in the given typelist Example: unique<typelist<int, float, double, float, int> gives typelist<int, float, double> | |
template<class T> | |
using | add_const_lvalue_reference_t = typename add_const_lvalue_reference<T>::type |
Convenience alias for add_const_lvalue_reference. | |
template<class T, bool is_const> | |
using | constify_t = typename constify<T, is_const>::type |
Convenience alias for constify. | |
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 an iterator. | |
Functions | |
template<class... Ts, class... Us> requires (!is_type_instance_of_v<Us, typelist> && ...) | |
consteval auto | append (typelist< Ts... >, Us...) |
Appends individual 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... >={}) |
Gets the count of types contained in a typelist. | |
template<class T, template< class > class P> requires ct_type_predicate<P, T> | |
consteval bool | evaluate (P< T >) |
Evaluates a compile-time template predicate. | |
template<class T, callable_type_predicate< T > P> | |
consteval bool | evaluate (P predicate) |
Evaluates a callable type predicate. | |
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 if at least one type in the typelist satisfies the predicate. | |
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 if at least one type satisfies the compile-time predicate. | |
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 if all types in the typelist satisfy the predicate. | |
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 if all types satisfy the compile-time predicate. | |
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) |
Finds the index of the first type satisfying the 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) |
Finds the index of the first type satisfying the compile-time predicate. | |
template<class TypeToFind, any_typelist L> | |
consteval std::size_t | find (L list) |
Finds the index of a specific type in the typelist. | |
template<any_typelist L, class V> | |
consteval bool | contains () |
Checks if a typelist contains a specific type. | |
void | unreachable () |
Invokes undefined behavior for optimization purposes. | |
Variables | |
template<class T, template< class... > class U> | |
constexpr bool | is_type_instance_of_v = is_type_instance_of<T, U>::value |
Variable template for convenient access to is_type_instance_of. | |
template<class CLS, class... ARGS> | |
constexpr bool | excludes_copy_and_move_ctor_v = excludes_copy_and_move_ctor<CLS, ARGS...>::value |
Convenience variable template for excludes_copy_and_move_ctor. | |
using sparrow::mpl::add_const_lvalue_reference_t = typename add_const_lvalue_reference<T>::type |
Convenience alias for add_const_lvalue_reference.
T | Type to get const lvalue reference of |
Definition at line 766 of file mp_utils.hpp.
using sparrow::mpl::append_t = decltype(append(TypeList{}, Us{}...)) |
Type alias for appending types or typelists to a given typelist.
This template alias provides a convenient way to append one or more types or typelists to an existing typelist using the append function.
TypeList | The typelist to which types will be appended |
Us | Types or typelists to be appended |
Definition at line 198 of file mp_utils.hpp.
using sparrow::mpl::constify_t = typename constify<T, is_const>::type |
Convenience alias for constify.
This is required since std::add_const_t<T&> is T& (not const T&).
T | Type to conditionally const-qualify |
is_const | Whether to add const qualification |
Definition at line 807 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 an iterator.
This utility determines the appropriate const reference type for an iterator, ensuring proper const-correctness for iterator operations.
T | Iterator type |
Definition at line 820 of file mp_utils.hpp.
using sparrow::mpl::merge_set = typename impl::merge_set_impl<L1, L2>::type |
Generates the union of two typelists, removing duplicates.
This utility merges two typelists and ensures that each type appears only once in the result, maintaining the order from the first list and adding new types from the second list.
L1 | First typelist |
L2 | Second typelist |
Definition at line 722 of file mp_utils.hpp.
using sparrow::mpl::rename = typename impl::rename_impl<From, To>::type |
Changes the template type of a type list.
This utility extracts the template arguments from one template instantiation and applies them to a different template.
From | Source template instantiation |
To | Target template to apply arguments to |
Definition at line 268 of file mp_utils.hpp.
using sparrow::mpl::transform = typename impl::transform_impl<F, L...>::type |
Applies a metafunction to each element of typelists.
This template applies the metafunction F to each tuple of elements in the provided typelists and returns the corresponding result list.
F | Metafunction to apply |
L | Typelist(s) to transform |
Definition at line 682 of file mp_utils.hpp.
using sparrow::mpl::unique = typename impl::unique_impl<L>::type |
Removes all duplicated types in the given typelist Example: unique<typelist<int, float, double, float, int> gives typelist<int, float, double>
Definition at line 740 of file mp_utils.hpp.
|
nodiscardconsteval |
Checks if all types satisfy the compile-time predicate.
Predicate | Template predicate to apply |
L | Typelist template |
T | Types in the typelist |
list | Typelist instance |
Definition at line 513 of file mp_utils.hpp.
|
nodiscardconsteval |
Checks if all types in the typelist satisfy the predicate.
Predicate | Callable predicate type |
L | Typelist template |
T | Types in the typelist |
predicate | Predicate to apply |
Definition at line 492 of file mp_utils.hpp.
|
nodiscardconsteval |
Checks if at least one type satisfies the compile-time predicate.
Predicate | Template predicate to apply |
L | Typelist template |
T | Types in the typelist |
list | Typelist instance |
Definition at line 471 of file mp_utils.hpp.
|
nodiscardconsteval |
Checks if at least one type in the typelist satisfies the predicate.
Predicate | Callable predicate type |
L | Typelist template |
T | Types in the typelist |
list | Typelist instance |
predicate | Predicate to apply (defaults to default-constructed) |
Definition at line 450 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 in order.
Ts | Types in the first typelist |
Us | Types in the second typelist |
list1 | The first typelist |
list2 | The second typelist |
Definition at line 174 of file mp_utils.hpp.
|
consteval |
Appends individual types to a typelist.
This function takes a typelist and additional types as arguments, and returns a new typelist containing all the types from the original typelist followed by the additional types.
Ts | Types in the original typelist |
Us | Additional types to be appended (must not be typelists) |
list | The original typelist |
types | The additional types to append |
Definition at line 149 of file mp_utils.hpp.
|
consteval |
P<T>::value
when called with T
in a type-wrapper. Definition at line 420 of file mp_utils.hpp.
|
nodiscardconsteval |
Checks if a typelist contains a specific type.
L | Typelist type to search in |
V | Type to search for |
Definition at line 633 of file mp_utils.hpp.
|
nodiscardconsteval |
Evaluates a callable type predicate.
T | Type to evaluate |
P | Callable predicate type |
predicate | Predicate instance |
Definition at line 371 of file mp_utils.hpp.
|
consteval |
Evaluates a compile-time template predicate.
T | Type to evaluate |
P | Template predicate to apply |
Definition at line 354 of file mp_utils.hpp.
|
nodiscardconsteval |
Finds the index of a specific type in the typelist.
TypeToFind | Type to search for |
L | Typelist type |
list | Typelist instance |
Definition at line 590 of file mp_utils.hpp.
|
nodiscardconsteval |
Finds the index of the first type satisfying the compile-time predicate.
Predicate | Template predicate to apply |
L | Typelist template |
T | Types in the typelist |
list | Typelist instance |
Definition at line 572 of file mp_utils.hpp.
|
nodiscardconsteval |
Finds the index of the first type satisfying the predicate.
Predicate | Callable predicate type |
L | Typelist template |
T | Types in the typelist |
list | Typelist instance |
predicate | Predicate to apply |
Definition at line 535 of file mp_utils.hpp.
|
constexpr |
Gets the count of types contained in a typelist.
T | Types in the typelist |
list | Typelist instance (defaulted for convenience) |
Definition at line 216 of file mp_utils.hpp.
|
inline |
Invokes undefined behavior for optimization purposes.
This function can be used to mark code paths that should never be reached, allowing compilers to optimize away impossible branches or trap execution in debug builds.
Definition at line 882 of file mp_utils.hpp.
|
constexpr |
Convenience variable template for excludes_copy_and_move_ctor.
CLS | Class type |
ARGS | Argument types to check |
Definition at line 1069 of file mp_utils.hpp.
|
constexpr |
Variable template for convenient access to is_type_instance_of.
Checks if T is a concrete instantiation of template U.
T | The concrete type to check |
U | The template to check against |
Definition at line 102 of file mp_utils.hpp.