OpenKalman
wrappable.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_WRAPPABLE_HPP
17 #define OPENKALMAN_WRAPPABLE_HPP
18 
19 
20 namespace OpenKalman
21 {
22  namespace detail
23  {
24  template<typename T, std::size_t...I>
25  constexpr bool wrappable_impl(std::index_sequence<I...>) {
26  return ((dynamic_dimension<T, I> or has_untyped_index<T, I + 1>) and ...); }
27 
28 #ifndef __cpp_concepts
29  template<typename T, typename = void>
30  struct is_wrappable : std::false_type {};
31 
32  template<typename T>
33  struct is_wrappable<T, std::enable_if_t<indexible<T> and (index_count<T>::value >= 1)>>
34  : std::bool_constant<(detail::wrappable_impl<T>(std::make_index_sequence<index_count_v<T> - 1>{}))> {};
35 #endif
36  }
37 
38 
44  template<typename T>
45 #ifdef __cpp_concepts
46  concept wrappable = indexible<T> and (index_count_v<T> >= 1) and
47  (detail::wrappable_impl<T>(std::make_index_sequence<index_count_v<T> - 1>{}));
48 #else
49  constexpr bool wrappable = detail::is_wrappable<T>::value;
50 #endif
51 
52 
53 } // namespace OpenKalman
54 
55 #endif //OPENKALMAN_WRAPPABLE_HPP
constexpr bool wrappable
Specifies that every fixed-size index of T (other than potentially index 0) is euclidean.
Definition: wrappable.hpp:49
Definition: tuple_reverse.hpp:103
The root namespace for OpenKalman.
Definition: basics.hpp:34
Definition: wrappable.hpp:30