16 #ifndef OPENKALMAN_DESCRIPTORS_GET_EUCLIDEAN_COMPONENT_START_INDICES_HPP 17 #define OPENKALMAN_DESCRIPTORS_GET_EUCLIDEAN_COMPONENT_START_INDICES_HPP 19 #include <type_traits> 32 template<std::
size_t i = 0,
typename Tup,
typename CurrLoc = std::
integral_constant<std::
size_t, 0>,
typename...Locs>
33 static constexpr
auto euclidean_component_start_indices_tuple(
const Tup& tup, CurrLoc currloc = {}, Locs...locs)
35 if constexpr (i < std::tuple_size_v<Tup>)
37 auto next_loc =
values::operation {std::plus{}, currloc, get_descriptor_stat_dimension(std::get<i>(tup))};
38 return euclidean_component_start_indices_tuple<i + 1>(tup, std::move(next_loc), std::move(locs)..., std::move(currloc));
40 else return std::tuple {std::move(locs)...};
52 #ifdef __cpp_lib_constexpr_vector 56 template<
typename Arg, std::enable_if_t<pattern<Arg>,
int> = 0>
61 if constexpr (descriptor<Arg>)
63 return std::array {std::integral_constant<std::size_t, 0>{}};
65 else if constexpr (descriptor_tuple<Arg>)
67 return detail::euclidean_component_start_indices_tuple(arg);
71 std::size_t i = 0, loc = 0;
72 std::vector<std::size_t> indices(
get_size(arg));
76 loc += get_descriptor_stat_dimension(c);
86 #endif //OPENKALMAN_DESCRIPTORS_GET_EUCLIDEAN_COMPONENT_START_INDICES_HPP
Definition: get_component_start_indices.hpp:29
Definition for coordinates::pattern.
Definition for coordinates::descriptor_tuple.
Definition for coordinates::descriptor.
auto get_euclidean_component_start_indices(Arg &&arg)
A collections::index mapping a component of T to an index within a vector.
Definition: get_euclidean_component_start_indices.hpp:59
Definition for collections::index.
operation(const Operation &, const Args &...) -> operation< Operation, Args... >
Deduction guide.
constexpr auto get_size(Arg &&arg)
Get the size of a sized object (e.g, a collection)
Definition: get_size.hpp:191
constexpr bool index
An object describing a collection of /ref values::index objects.
Definition: index.hpp:75