Callable object checking if a product type contains fields based on on selected identifier.
#include <kumi/algorithm/contains.hpp>
constexpr auto contains_only(T && t, IDs
const&... ids)
noexcept;
constexpr contains_only_t contains_only
Callable object checking if a product type contains fields based on on selected identifier.
Definition contains.hpp:225
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 any of the ids, std::false_type otherwise.
template<kumi::concepts::product_type T, kumi::concepts::identifier... IDs>
struct contains_only
{
};
template<kumi::concepts::product_type T, kumi::concepts::identifier... IDs>
using contains_only_t = typename kumi::result::contains_only<T, IDs...>::type;
Computes the return type of a call to kumi:contains_only
#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>{} });
check_contains(
kumi::tuple{
"active"_id = std::bool_constant<true>{},
"value"_id = 17} );
check_contains(
kumi::tuple{
"active"_id = std::bool_constant<true>{},
"value"_id = 17,
"other"_id =
false});
}
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>{} });
check_contains(
kumi::record{
"active"_id = std::bool_constant<true>{},
"value"_id = 17} );
check_contains(
kumi::record{
"active"_id = std::bool_constant<true>{},
"value"_id = 17,
"other"_id =
false});
}
Fixed-size collection of heterogeneous tagged fields, tags are unique.
Definition record.hpp:36