sparrow ..
Loading...
Searching...
No Matches
mp_utils.hpp File Reference
#include <concepts>
#include <cstdint>
#include <iterator>
#include <memory>
#include <ranges>
#include <tuple>
#include <type_traits>
Include dependency graph for mp_utils.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sparrow::mpl::dependent_false< T >
 Workaround to replace static_assert(false) in template code. More...
 
struct  sparrow::mpl::is_type_instance_of< L, U >
 Type trait to check if a type is an instantiation of a template. More...
 
struct  sparrow::mpl::is_type_instance_of< L< T... >, U >
 Specialization for matching template instantiations. More...
 
struct  sparrow::mpl::typelist< T >
 A sequence of types used for metaprogramming operations. More...
 
struct  sparrow::mpl::impl::rename_impl< From< T... >, To >
 
struct  sparrow::mpl::predicate::same_as< T >
 Compile-time type predicate: true if the evaluated type is the same as T. More...
 
struct  sparrow::mpl::ct_type_predicate_to_callable< P >
 
struct  sparrow::mpl::impl::contains_impl< L<>, T >
 
struct  sparrow::mpl::impl::contains_impl< L< T, U... >, T >
 
struct  sparrow::mpl::impl::contains_impl< L< V, U... >, T >
 
struct  sparrow::mpl::impl::transform_impl< F, L >
 
struct  sparrow::mpl::impl::transform_impl< F, L< T... > >
 
struct  sparrow::mpl::impl::transform_impl< F, L1< T1... >, L2< T2... > >
 
struct  sparrow::mpl::impl::merge_set_impl< L< T... >, L<> >
 
struct  sparrow::mpl::impl::merge_set_impl< L< T... >, L< U, V... > >
 
struct  sparrow::mpl::impl::unique_impl< L< T... > >
 
struct  sparrow::mpl::add_const_lvalue_reference< T >
 Adds const and lvalue reference to a type. More...
 
struct  sparrow::mpl::constify< T, is_const >
 Conditionally adds const to a type. More...
 
struct  sparrow::mpl::constify< T &, is_const >
 Specialization for reference types. More...
 
struct  sparrow::mpl::excludes_copy_and_move_ctor< CLS, ARGS >
 Helper to exclude copy and move constructors from variadic templates. More...
 
struct  sparrow::mpl::excludes_copy_and_move_ctor< CLS >
 Specialization for no arguments. More...
 
struct  sparrow::mpl::excludes_copy_and_move_ctor< CLS, T >
 Specialization for single argument. More...
 

Namespaces

namespace  sparrow
 
namespace  sparrow::mpl
 
namespace  sparrow::mpl::impl
 
namespace  sparrow::mpl::predicate
 

Concepts

concept  sparrow::mpl::any_typelist
 Concept that matches any typelist instantiation.
 
concept  sparrow::mpl::type_wrapper
 Concept for template types that can wrap a single type.
 
concept  sparrow::mpl::ct_type_predicate
 Concept for compile-time type predicates.
 
concept  sparrow::mpl::callable_type_predicate
 Concept for callable type predicates.
 
concept  sparrow::mpl::constant_iterator
 Concept for constant iterators.
 
concept  sparrow::mpl::constant_range
 Concept for constant ranges.
 
concept  sparrow::mpl::bool_convertible_range
 Concept for ranges whose elements are convertible to bool.
 
concept  sparrow::mpl::boolean_like
 Concept for boolean-like types.
 
concept  sparrow::mpl::convertible_ranges
 Concept for convertible range types.
 
concept  sparrow::mpl::unique_ptr
 Concept for unique_ptr instances.
 
concept  sparrow::mpl::unique_ptr_or_derived
 Concept for unique_ptr or derived types.
 
concept  sparrow::mpl::shared_ptr
 Concept for shared_ptr instances.
 
concept  sparrow::mpl::shared_ptr_or_derived
 Concept for shared_ptr or derived types.
 
concept  sparrow::mpl::smart_ptr
 Concept for any smart pointer type.
 
concept  sparrow::mpl::smart_ptr_and_derived
 Concept for smart pointers and derived types.
 
concept  sparrow::mpl::testable
 Concept for testable types in boolean contexts.
 
concept  sparrow::mpl::T_matches_qualifier_if_Y_is
 Concept for matching qualifier requirements.
 
concept  sparrow::mpl::iterator_of_type
 Concept for iterators of a specific value type.
 
concept  sparrow::mpl::char_like
 Concept for character-like types.
 
concept  sparrow::mpl::std_array
 Concept for std::array types.
 
concept  sparrow::mpl::weakly_equality_comparable_with
 

Typedefs

template<class TypeList, class... Us>
using sparrow::mpl::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 sparrow::mpl::rename = typename impl::rename_impl<From, To>::type
 Changes the template type of a type list.
 
template<template< class > class F, class... L>
using sparrow::mpl::transform = typename impl::transform_impl<F, L...>::type
 Applies a metafunction to each element of typelists.
 
template<class L1, class L2>
using sparrow::mpl::merge_set = typename impl::merge_set_impl<L1, L2>::type
 Generates the union of two typelists, removing duplicates.
 
template<class L>
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>
 
template<class T>
using sparrow::mpl::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 sparrow::mpl::constify_t = typename constify<T, is_const>::type
 Convenience alias for constify.
 
template<class T>
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.
 

Functions

template<class... Ts, class... Us>
requires (!is_type_instance_of_v<Us, typelist> && ...)
consteval auto sparrow::mpl::append (typelist< Ts... >, Us...)
 Appends individual types to a typelist.
 
template<class... Ts, class... Us>
consteval auto sparrow::mpl::append (typelist< Ts... >, typelist< Us... >)
 Appends two typelists together.
 
template<class... T>
constexpr std::size_t sparrow::mpl::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 sparrow::mpl::evaluate (P< T >)
 Evaluates a compile-time template predicate.
 
template<class T, callable_type_predicate< T > P>
consteval bool sparrow::mpl::evaluate (P predicate)
 Evaluates a callable type predicate.
 
template<template< class > class P>
consteval auto sparrow::mpl::as_predicate ()
 
template<class Predicate, template< class... > class L, class... T>
requires any_typelist<L<T...>> and (callable_type_predicate<Predicate, T> && ...)
consteval bool sparrow::mpl::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 sparrow::mpl::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 sparrow::mpl::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 sparrow::mpl::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 sparrow::mpl::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 sparrow::mpl::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 sparrow::mpl::find (L list)
 Finds the index of a specific type in the typelist.
 
template<any_typelist L, class V>
consteval bool sparrow::mpl::contains ()
 Checks if a typelist contains a specific type.
 
void sparrow::mpl::unreachable ()
 Invokes undefined behavior for optimization purposes.
 

Variables

template<class T, template< class... > class U>
constexpr bool sparrow::mpl::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 sparrow::mpl::excludes_copy_and_move_ctor_v = excludes_copy_and_move_ctor<CLS, ARGS...>::value
 Convenience variable template for excludes_copy_and_move_ctor.