16 #ifndef OPENKALMAN_PATTERNS_COMPARE_COLLECTION_PATTERNS_WITH_DIMENSION_HPP 17 #define OPENKALMAN_PATTERNS_COMPARE_COLLECTION_PATTERNS_WITH_DIMENSION_HPP 31 #ifndef __cpp_concepts 32 template<
typename T,
typename =
void>
43 do_compare = [](
const auto& a,
const auto& b) {
48 template<std::
size_t n, auto comp, std::
size_t i = 0,
typename T,
typename D>
50 compare_collection_patterns_with_dimension_impl(
const T& t,
const D& d)
56 compare_collection_patterns_with_dimension_impl<n, comp, i + 1>(t, d));
58 return std::true_type {};
71 template<auto comp = &stdex::is_eq, auto N = values::unbounded_size, pattern_collection T, values::index D> requires
74 constexpr OpenKalman::internal::boolean_testable
auto 76 template<
auto comp = &stdex::is_eq, std::size_t N =
values::unbounded_size,
typename T,
typename D, std::enable_if_t<
82 constexpr
bool has_fixed_common =
84 requires { requires fixed_pattern<collections::common_collection_type_t<T>>; };
89 if constexpr (collections::sized<T>)
92 auto n = [](
const T& t){
100 return std::integral_constant<std::size_t, N>{};
102 using n_type = decltype(n);
104 if constexpr (values::fixed<n_type>)
109 return detail::compare_collection_patterns_with_dimension_impl<values::fixed_value_of_v<n_type>, comp>(t, d);
113 for (std::size_t i = 0; i < n; ++i)
118 else if constexpr (has_fixed_common)
124 return std::false_type {};
133 #ifdef __cpp_concepts 134 template<std::
size_t dim, auto comp = &stdex::is_eq, auto N = values::unbounded_size, pattern_collection T> requires
137 constexpr OpenKalman::internal::boolean_testable
auto 139 template<std::size_t dim,
auto comp = &stdex::is_eq, std::size_t N =
values::unbounded_size,
typename T, std::enable_if_t<
145 return compare_collection_patterns_with_dimension<comp, N>(t, std::integral_constant<std::size_t, dim>{});
Definition for pattern_collection.
The size of a patterns::pattern.
Definition: dimension_of.hpp:36
constexpr auto get_size(Arg &&arg)
Get the size of a sized object (e.g, a collection)
Definition: get_size.hpp:224
decltype(auto) constexpr get_pattern(P &&p, I i)
Get a pattern within a pattern_collection.
Definition: get_pattern.hpp:39
Definition: comparison.hpp:176
typename common_collection_type< T >::type common_collection_type_t
Helper template for common_collection_type.
Definition: common_collection_type.hpp:81
decltype(auto) constexpr to_value_type(Arg &&arg)
Convert, if necessary, a fixed or dynamic value to its underlying base type.
Definition: to_value_type.hpp:28
Definition for patterns::get_pattern.
Definition for patterns::fixed_pattern.
constexpr bool value
T is a fixed or dynamic value that is reducible to a number.
Definition: value.hpp:45
The namespace for features relating to patterns::pattern object.
Definition: collection_compares_with.hpp:24
constexpr auto compare_collection_patterns_with_dimension(const T &t, const D &d)
Compares the dimensions of the first N elements of a pattern_collection with a particular value...
Definition: compare_collection_patterns_with_dimension.hpp:80
Inclusion file for collections.
A type reflecting an unbound size.
Definition: size.hpp:27
constexpr bool size_compares_with
T and U are sizes that compare in a particular way based on parameter comp.
Definition: size_compares_with.hpp:98
constexpr bool integral
T is an integral value.
Definition: integral.hpp:47
Definition for patterns::get_dimension.
constexpr unbounded_size_t unbounded_size
An instance of unbounded_size_t;.
Definition: size.hpp:60
Definition: compare_collection_patterns_with_dimension.hpp:33
constexpr auto get_dimension(const Arg &arg)
Get the vector dimension of patterns::pattern Arg.
Definition: get_dimension.hpp:53
constexpr auto operation(Operation &&op, Args &&...args)
A potentially constant-evaluated operation involving some number of values.
Definition: operation.hpp:98
Definition for patterns::dimension_of.