OpenKalman
pattern_collection_for.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) 2024-2025 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_COMPATIBLE_SHAPE_WITH_HPP
17 #define OPENKALMAN_COMPATIBLE_SHAPE_WITH_HPP
18 
19 #include "coordinates/coordinates.hpp"
22 
23 namespace OpenKalman
24 {
25  namespace detail
26  {
28  struct compatible_shape_with_impl : std::false_type {};
29 
30  template<typename P, typename T, applicability a, std::size_t...i>
31  struct compatible_shape_with_impl<P, T, a, std::index_sequence<i...>>
32  : std::bool_constant<(... and
33  (coordinates::dimension_of_v<collections::collection_element_t<i, P>> == index_dimension_of_v<T, i> and
34  (i < index_count_v<T> or
35  coordinates::compares_with<collections::collection_element_t<i, P>, coordinates::Dimensions<1>>)))> {};
36 
37 #ifndef __cpp_concepts
38  template<typename P, typename T, applicability a, typename = void>
39  struct compatible_shape_with_impl_cpp17 : std::false_type{};
40 
41  template<typename P, typename T, applicability a>
42  struct compatible_shape_with_impl_cpp17<P, T, a, std::enable_if_t<
43  coordinates::pattern_collection<P> and
44  indexible<T> and
45  collections::size_of<P>::value != stdex::dynamic_extent>>
46  : compatible_shape_with_impl<P, T, a> {};
47 #endif
48  }
49 
50 
58  template<typename P, typename T, applicability a = applicability::permitted>
59 #ifdef __cpp_concepts
60  concept pattern_collection_for =
61  coordinates::pattern_collection<P> and
62  indexible<T> and
63  values::fixed_value_compares_with<collections::size_of<P>, std::dynamic_extent, &std::is_neq> and
64  detail::compatible_shape_with_impl<P, T, a>::value;
65 #else
66  constexpr bool pattern_collection_for = detail::compatible_shape_with_impl_cpp17<P, T, a>::value;
67 #endif
68 
69 
70 }
71 
72 #endif
applicability
The applicability of a concept, trait, or restraint.
Definition: constants.hpp:35
constexpr bool value
T is a fixed or dynamic value that is reducible to a number.
Definition: value.hpp:45
The root namespace for OpenKalman.
Definition: basics.hpp:34
Definition for index_dimension_of.
Definition for indexible.
Definition: pattern_collection_for.hpp:28