OpenKalman
vector_space_descriptors_may_match_with.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-2024 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_VECTOR_SPACE_DESCRIPTORS_MAY_MATCH_WITH_HPP
17 #define OPENKALMAN_VECTOR_SPACE_DESCRIPTORS_MAY_MATCH_WITH_HPP
18 
20 
21 namespace OpenKalman
22 {
23  namespace detail
24  {
25  template<std::size_t I, typename T, typename...Ts>
26  constexpr bool maybe_equivalent_descriptors_per_index()
27  {
28  return (... and compares_with<vector_space_descriptor_of_t<T, I>, vector_space_descriptor_of_t<Ts, I>, equal_to<>, Applicability::permitted>);
29  }
30 
31  template<typename...Ts, std::size_t...Is>
32  constexpr bool vector_space_descriptors_may_match_with_impl(std::index_sequence<Is...>)
33  {
34  if constexpr (sizeof...(Ts) < 2) return true;
35  else return (... and maybe_equivalent_descriptors_per_index<Is, Ts...>());
36  }
37  } // namespace detail
38 
45  template<typename...Ts>
46 #ifdef __cpp_concepts
48 #else
49  constexpr bool vector_space_descriptors_may_match_with =
50 #endif
51  (indexible<Ts> and ...) and
52  detail::vector_space_descriptors_may_match_with_impl<Ts...>(std::make_index_sequence<std::max({std::size_t{0}, index_count_v<Ts>...})>{});
53 
54 
55 } // namespace OpenKalman
56 
57 #endif //OPENKALMAN_VECTOR_SPACE_DESCRIPTORS_MAY_MATCH_WITH_HPP
Definition for compares_with.
The root namespace for OpenKalman.
Definition: basics.hpp:34
The concept, trait, or restraint is permitted, but whether it applies is not necessarily known at com...
constexpr bool vector_space_descriptors_may_match_with
Specifies that indexible objects Ts may have equivalent dimensions and vector-space types...
Definition: vector_space_descriptors_may_match_with.hpp:49