sparrow ..
Loading...
Searching...
No Matches
sparrow::mpl::callable_type_predicate Concept Reference

Concept for callable type predicates. More...

#include <mp_utils.hpp>

Concept definition

template<class P, class T>
concept sparrow::mpl::callable_type_predicate = std::semiregular<std::decay_t<P>>
and (
requires(std::decay_t<P> predicate)
{
{ predicate(typelist<T>{}) } -> std::convertible_to<bool>;
}
or
requires(std::decay_t<P> predicate)
{
{ predicate(std::type_identity_t<T>{}) } -> std::convertible_to<bool>;
}
)
Concept for callable type predicates.
Definition mp_utils.hpp:328
A sequence of types used for metaprogramming operations.
Definition mp_utils.hpp:123

Detailed Description

Concept for callable type predicates.

This concept matches types whose instances can be called with an object representing a type to evaluate it. The object passed can be either a typelist with one element or std::type_identity_t<T>.

Template Parameters
PPredicate type to check
TType to apply predicate to
Precondition
P must be semiregular
Postcondition
True if P instance can be called with type wrapper of T
auto predicate = [](auto type_wrapper) { return / some condition /; };
static_assert(callable_type_predicate<decltype(predicate), int>);
Concept for template types that can wrap a single type.
Definition mp_utils.hpp:286

Definition at line 328 of file mp_utils.hpp.