17 #ifndef OPENKALMAN_TO_EXTENTS_HPP 18 #define OPENKALMAN_TO_EXTENTS_HPP 28 template<
typename P, std::
size_t curr_rank = collections::size_of_v<P>>
30 : std::integral_constant<
32 dimension_of_v<pattern_collection_element_t<curr_rank - 1, P>> == 1 ?
33 derive_rank<P, curr_rank - 1>::value :
38 struct derive_rank<P, 0> : std::integral_constant<std::size_t, 0> {};
41 template<std::size_t previous_i, std::size_t...SDs,
typename P,
typename...Ds>
43 derive_extents(
const P& p, Ds...ds)
45 if constexpr (previous_i == 0)
51 constexpr std::size_t i = previous_i - 1;
54 return derive_extents<i, values::fixed_value_of_v<decltype(d)>, SDs...>(p, std::move(ds)...);
56 return derive_extents<i, stdex::dynamic_extent, SDs...>(p, std::move(d), std::move(ds)...);
69 #ifdef __cpp_lib_constexpr_vector 70 template<std::
size_t rank, pattern_collection P> requires
71 values::fixed_value_compares_with<collections::size_of<P>, stdex::dynamic_extent, &stdex::is_neq>
73 template<std::size_t rank,
typename P, std::enable_if_t<
74 pattern_collection<P> and
75 values::fixed_value_compares_with<collections::size_of<P>, stdex::dynamic_extent, &stdex::is_neq>,
int> = 0>
81 return detail::derive_extents<rank>(p);
88 template<std::size_t rank,
typename IndexType, std::size_t...Extents>
89 constexpr decltype(
auto)
90 to_extents(const stdex::extents<IndexType, Extents...>& p)
93 static_assert(rank >= N);
94 if constexpr (rank > N)
95 return detail::derive_extents<rank>(p);
104 template<std::size_t rank,
typename IndexType, std::size_t...Extents>
109 static_assert(rank >= N);
110 if constexpr (rank > N)
111 return detail::derive_extents<rank>(std::move(p));
121 #ifdef __cpp_lib_constexpr_vector 122 template<pattern_collection P> requires
123 values::fixed_value_compares_with<collections::size_of<P>, stdex::dynamic_extent, &stdex::is_neq>
125 template<
typename P, std::enable_if_t<
126 pattern_collection<P> and
127 values::fixed_value_compares_with<collections::size_of<P>, stdex::dynamic_extent, &stdex::is_neq>,
int> = 0>
Definition for pattern_collection.
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
Definition: to_extents.hpp:29
Definition for patterns::get_dimension.
constexpr bool fixed
T has a value that is determinable at compile time.
Definition: fixed.hpp:65
Definition for collections::pattern_collection_element.
constexpr auto get_dimension(const Arg &arg)
Get the vector dimension of patterns::pattern Arg.
Definition: get_dimension.hpp:53
constexpr auto to_extents(P &&p)
Convert a pattern_collection to std::extents.
Definition: to_extents.hpp:78
Definition: extents.hpp:372