Checks if a product type contains at least one of many identifiers.
- Parameters
-
| t | the product type to inspect. |
| ids | Identifiers to check |
- Returns
- std::true_type if t contains a field labeld by one of the ids, and std::false_type otherwise.
Helper type
namespace kumi::result
{
using contains_any_t =
typename contains_any<T,ID...>::type;
}
Concept specifying a type represent an identifier.
Definition concepts.hpp:193
constexpr auto contains_any(T &&t, Is const &... ids) noexcept
Checks if a product type contains at least one of many identifiers.
Definition contains.hpp:94
Computes the type returned by a call to contains_any.
Examples:
Tuple:
#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
Record:
#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