16 #ifndef OPENKALMAN_ELEMENTACCESSOR_HPP 17 #define OPENKALMAN_ELEMENTACCESSOR_HPP 28 #ifdef __cpp_lib_ranges 29 template<indexible Object, index_range_for<Object> Indices> requires
30 writable_by_component<Object, Indices> and values::index<std::ranges::range_value_t<Indices>>
32 template<
typename Object,
typename Indices>
39 #ifdef __cpp_lib_ranges 40 template<
typename Arg, std::invocable PreAccess, std::invocable PostSet> requires
41 std::same_as<Scalar, scalar_type_of_t<Arg>>
43 template<
typename Arg,
typename PreAccess,
typename PostSet, std::enable_if_t<
44 std::is_invocable_v<PreAccess> and std::is_invocable_v<PostSet> and
45 std::is_same_v<Scalar, typename scalar_type_of<Arg>::type>,
int> = 0>
47 ElementAccessor(Arg&& arg, Indices&& indices, PreAccess&& pre_access = []{}, PostSet&& post_set = []{})
48 :
object {std::forward<Arg>(arg)},
49 indices {std::forward<Indices>(indices)},
50 before_access {std::forward<decltype(pre_access)>(pre_access)},
51 after_set {std::forward<decltype(post_set)>(post_set)} {}
55 operator Scalar()
const 76 const std::function<void()> before_access;
78 const std::function<void()> after_set;
87 template<
typename Arg,
typename Indices,
typename PreAccess,
typename PostSet>
93 #endif //OPENKALMAN_ELEMENTACCESSOR_HPP Definition: ElementAccessor.hpp:34
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
void operator=(Scalar s)
Set an element.
Definition: ElementAccessor.hpp:63
decltype(auto) constexpr get_component(Arg &&arg, const Indices &indices)
Get a component of an object at a particular set of indices.
Definition: get_component.hpp:54
Definition: basics.hpp:48