Callable object checking if a product type contains at least one of many identifier.
#include <kumi/algorithm/contains.hpp>
constexpr auto contains_any(T && t, IDs
const&... ids)
noexcept;
constexpr contains_any_t contains_any
Callable object checking if a product type contains at least one of many identifier.
Definition contains.hpp:175
identifier definition class
Definition identifier.hpp:86
- t: The product type to inspect
- ids: The identifiers to check for
- std::true_type if t contains a field labeled with one of the ids, std::false_type otherwise.
template<kumi::concepts::product_type T, kumi::concepts::identifier... IDs>
struct contains_any
{
};
template<kumi::concepts::product_type T, kumi::concepts::identifier... IDs>
using contains_any_t = typename kumi::result::contains_any<T, IDs...>::type;
Computes the return type of a call to kumi:contains_any
#include <kumi/kumi.hpp>
#include <iostream>
using namespace kumi::literals;
template<kumi::concepts::product_type T>
void check_contains(T const& )
{
std::cout << "Correct product_type\n";
else
std::cout << "Incorrect product type\n";
}
int main()
{
check_contains(
kumi::tuple{
"malus"_id = 6.5,
"value"_id = 17} );
check_contains(
kumi::tuple{
"active"_id = std::bool_constant<true>{},
"value"_id = 17} );
}
Fixed-size collection of heterogeneous values.
Definition tuple.hpp:33
#include <kumi/kumi.hpp>
#include <iostream>
using namespace kumi::literals;
template<kumi::concepts::product_type T>
void check_contains(T const& )
{
std::cout << "Correct product_type\n";
else
std::cout << "Incorrect product type\n";
}
int main()
{
check_contains(
kumi::record{
"malus"_id = 6.5,
"value"_id = 17} );
check_contains(
kumi::record{
"active"_id = std::bool_constant<true>{},
"value"_id = 17} );
}
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36