OpenKalman
euclidean_pattern_tuple.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_EUCLIDEAN_PATTERN_TUPLE_HPP
17 #define OPENKALMAN_EUCLIDEAN_PATTERN_TUPLE_HPP
18 
19 #include <type_traits>
20 #include <tuple>
23 
25 {
26 #if not defined(__cpp_concepts) or __cpp_generic_lambdas < 201707L
27  namespace detail
28  {
29  template<typename T, std::size_t...Ix>
30  constexpr bool is_euclidean_pattern_tuple_impl(std::index_sequence<Ix...>)
31  {
32  return (... and euclidean_pattern<std::tuple_element_t<Ix, T>>);
33  }
34 
35  template<typename T, typename = void>
36  struct is_euclidean_pattern_tuple : std::false_type {};
37 
38  template<typename T>
39  struct is_euclidean_pattern_tuple<T, std::enable_if_t<tuple_like<T>>>
40  : std::bool_constant<is_euclidean_pattern_tuple_impl<T>(std::make_index_sequence<std::tuple_size_v<T>>{})> {};
41  } // namespace detail
42 #endif
43 
44 
48  template<typename T>
49 #if defined(__cpp_concepts) and __cpp_generic_lambdas >= 201707L
50  concept euclidean_pattern_tuple =
51  coordinates::pattern_tuple<T> and
52  []<std::size_t...Ix>(std::index_sequence<Ix...>)
53  { return (... and euclidean_pattern<std::tuple_element_t<Ix, std::decay_t<T>>>); }
54  (std::make_index_sequence<std::tuple_size_v<std::decay_t<T>>>{});
55 #else
56  constexpr bool euclidean_pattern_tuple =
57  detail::is_euclidean_pattern_tuple<std::decay_t<T>>::value;
58 #endif
59 
60 
61 } // namespace OpenKalman::coordinates
62 
63 #endif //OPENKALMAN_EUCLIDEAN_PATTERN_TUPLE_HPP
Definition for collections::tuple_like.
Definition for coordinates::euclidean_pattern.
Definition: tuple_reverse.hpp:103
constexpr bool euclidean_pattern_tuple
An object describing a tuple-like collection of /ref coordinates::pattern objects.
Definition: euclidean_pattern_tuple.hpp:56
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31
Definition: compares_with.hpp:28