OpenKalman
writable_by_component.hpp
Go to the documentation of this file.
1 /* This file is part of OpenKalman, a header-only C++ library for
2  * Kalman filters and other recursive filters.
3  *
4  * Copyright (c) 2019-2023 Christopher Lee Ogden <ogden@gatech.edu>
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
9  */
10 
16 #ifndef OPENKALMAN_WRITABLE_BY_COMPONENT_HPP
17 #define OPENKALMAN_WRITABLE_BY_COMPONENT_HPP
18 
19 
20 namespace OpenKalman
21 {
27  template<typename T, typename Indices =
28  std::conditional_t<index_count_v<T> == dynamic_size, std::vector<std::size_t>, std::array<std::size_t, index_count_v<T>>>>
29 #ifdef __cpp_lib_concepts
30  concept writable_by_component =
31  indexible<T> and index_range_for<Indices, T> and
32  (not std::is_const_v<std::remove_reference_t<T>>) and (not empty_object<T>) and
33  interface::set_component_defined_for<
34  T, std::add_lvalue_reference_t<T>, const scalar_type_of_t<T>&, const Indices&>;
35 #else
36  constexpr bool writable_by_component =
37  indexible<T> and index_range_for<Indices, T> and
38  (not std::is_const_v<std::remove_reference_t<T>>) and (not empty_object<T>) and
39  interface::set_component_defined_for<
40  T, std::add_lvalue_reference_t<T>, const typename scalar_type_of<T>::type&, const Indices&>;
41 #endif
42 
43 
44 } // namespace OpenKalman
45 
46 #endif //OPENKALMAN_WRITABLE_BY_COMPONENT_HPP
typename scalar_type_of< T >::type scalar_type_of_t
helper template for scalar_type_of.
Definition: scalar_type_of.hpp:54
Definition: tuple_reverse.hpp:103
Type scalar type (e.g., std::float, std::double, std::complex<double>) of a tensor.
Definition: scalar_type_of.hpp:32
The root namespace for OpenKalman.
Definition: basics.hpp:34
constexpr std::size_t dynamic_size
A constant indicating that a size or index is dynamic.
Definition: global-definitions.hpp:33
constexpr bool empty_object
Specifies that an object is empty (i.e., at least one index is zero-dimensional). ...
Definition: empty_object.hpp:39
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