16 #ifndef OPENKALMAN_SET_COMPONENT_HPP 17 #define OPENKALMAN_SET_COMPONENT_HPP 26 template<
typename Arg,
typename Indices>
28 set_component_impl(Arg&& arg,
const scalar_type_of_t<Arg>& s,
const Indices& indices)
30 using Trait = interface::library_interface<std::decay_t<Arg>>;
32 return std::forward<Arg>(arg);
44 #ifdef __cpp_lib_concepts 45 template<indexible Arg, index_range_for<Arg> Indices> requires writable_by_component<Arg, Indices>
47 template<
typename Arg,
typename Indices, std::enable_if_t<
48 indexible<Arg> and index_range_for<Indices, Arg> and writable_by_component<Arg, Indices>,
int> = 0>
53 return detail::set_component_impl(std::forward<Arg>(arg), s, indices);
60 #ifdef __cpp_lib_concepts 61 template<indexible Arg, values::index Ix> requires writable_by_component<Arg, const std::initializer_list<Ix>&>
63 template<
typename Arg,
typename Ix, std::enable_if_t<
64 indexible<Arg> and values::index<Ix> and writable_by_component<Arg, const std::initializer_list<Ix>&>,
int> = 0>
69 return detail::set_component_impl(std::forward<Arg>(arg), s, indices);
79 #ifdef __cpp_lib_concepts 81 (index_count_v<Arg> ==
dynamic_size or
sizeof...(I) >= index_count_v<Arg>) and
84 template<
typename Arg,
typename...I, std::enable_if_t<
92 if constexpr (
sizeof...(I) == 0)
93 return detail::set_component_impl(std::forward<Arg>(arg), s, std::array<std::size_t, 0> {});
95 return detail::set_component_impl(std::forward<Arg>(arg), s,
96 std::array {
static_cast<std::common_type_t<I...
>>(std::forward<I>(i))...});
102 #endif //OPENKALMAN_SET_COMPONENT_HPP constexpr auto count_indices(const T &t)
Get the number of indices available to address the components of an indexible object.
Definition: count_indices.hpp:33
Arg && set_component(Arg &&arg, const scalar_type_of_t< Arg > &s, I &&...i)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: set_component.hpp:90
Arg && set_component(Arg &&arg, const scalar_type_of_t< Arg > &s, const Indices &indices)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: set_component.hpp:51
typename scalar_type_of< T >::type scalar_type_of_t
helper template for scalar_type_of.
Definition: scalar_type_of.hpp:54
The root namespace for OpenKalman.
Definition: basics.hpp:34
Definition: get_component.hpp:95
constexpr bool index
T is an index value.
Definition: index.hpp:56
The minimum number of indices need to access all the components of an object.
Definition: index_count.hpp:33
constexpr std::size_t dynamic_size
A constant indicating that a size or index is dynamic.
Definition: global-definitions.hpp:33
constexpr bool writable_by_component
Specifies that a type has components that can be set with Indices (an std::ranges::input_range) of ty...
Definition: writable_by_component.hpp:36