KUMI v4.0.0
Flawless Fluorite
Loading...
Searching...
No Matches

◆ contains_none()

template<concepts::product_type T, concepts::identifier... Is>
auto kumi::contains_none ( T && t,
Is const &... ids )
inlineconstexprnoexcept

Checks if a product type contains no fields based on any of the selected identifiers.

Parameters
tthe product type to inspect.
idsIdentifiers to check
Returns
std::true_type if t contains no field labeled by any of the ids, and std::false_type otherwise.

Helper type

namespace kumi::result
{
template<product_type T, concepts::identifier... ID> struct contains_none;
template<product_type T, concepts::identifier... ID>
using contains_none_t = typename contains_none<T,ID...>::type;
}
Concept specifying a type represent an identifier.
Definition concepts.hpp:193
constexpr auto contains_none(T &&t, Is const &... ids) noexcept
Checks if a product type contains no fields based on any of the selected identifiers.
Definition contains.hpp:172

Computes the type returned by a call to contains_none.

Examples:

Tuple:

#include <kumi/kumi.hpp>
#include <iostream>
using namespace kumi::literals;
template<kumi::concepts::product_type T>
void check_contains(T const& )
{
if constexpr(contains_none(T{}, "malus"_id, "other"_id))
std::cout << "Correct product_type\n";
else
std::cout << "Incorrect product type\n";
}
int main()
{
check_contains( kumi::tuple{"value"_id = 9 });
check_contains( kumi::tuple{"active"_id = std::bool_constant<true>{}});
check_contains( kumi::tuple{"malus"_id = 6.5, "value"_id = 17} );
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

Record:

#include <kumi/kumi.hpp>
#include <iostream>
using namespace kumi::literals;
template<kumi::concepts::product_type T>
void check_contains(T const& )
{
if constexpr(contains_none(T{}, "malus"_id, "other"_id))
std::cout << "Correct product_type\n";
else
std::cout << "Incorrect product type\n";
}
int main()
{
check_contains( kumi::record{"value"_id = 9 });
check_contains( kumi::record{"active"_id = std::bool_constant<true>{}});
check_contains( kumi::record{"malus"_id = 6.5, "value"_id = 17} );
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