17 #ifndef OPENKALMAN_MAKE_FIXED_SIZE_ADAPTER_LIKE_HPP 18 #define OPENKALMAN_MAKE_FIXED_SIZE_ADAPTER_LIKE_HPP 24 template<std::size_t I,
typename...Ts>
25 constexpr decltype(
auto) best_desc_Ts_impl(const Ts&...ts)
31 template<
typename...Ts,
typename Arg, std::size_t...Ix>
32 constexpr decltype(
auto) make_fixed_size_adapter_like_impl(Arg&& arg,
std::index_sequence<Ix...>)
34 if constexpr (
sizeof...(Ts) == 0) return
std::forward<Arg>(arg);
37 using F = decltype(make_fixed_size_adapter<decltype(best_desc_Ts_impl<Ix>(std::declval<Ts>()...))...>(std::declval<Arg&&>()));
38 constexpr
bool better = (... or (dynamic_dimension<Arg, Ix> and not dynamic_dimension<F, Ix>));
39 if constexpr (better)
return F {std::forward<Arg>(arg)};
40 else return std::forward<Arg>(arg);
52 template<
indexible...Ts, vector_space_descriptors_may_match_with<Ts...> Arg> requires (index_count_v<Arg> != stdex::dynamic_extent)
54 template<
typename...Ts,
typename Arg, std::enable_if_t<(... and indexible<Ts>) and
55 vector_space_descriptors_may_match_with<Arg, Ts...> and (index_count_v<Arg> != stdex::dynamic_extent),
int> = 0>
57 constexpr decltype(
auto)
58 make_fixed_size_adapter_like(Arg&& arg)
60 constexpr
auto min_count = std::min({index_count_v<Arg>,
61 (index_count_v<Ts> == stdex::dynamic_extent ? index_count_v<Arg> : index_count_v<Ts>)...});
62 return detail::make_fixed_size_adapter_like_impl<Ts...>(std::forward<Arg>(arg), std::make_index_sequence<min_count>{});
constexpr bool indexible
T is a multidimensional array type.
Definition: indexible.hpp:32
decltype(auto) constexpr most_fixed_pattern(P &&p)
Given a fixed-size /ref coordinates::pattern_collection, return the first component, if any, that is a fixed_pattern.
Definition: most_fixed_pattern.hpp:63
Definition: basics.hpp:48