OpenKalman
dynamic_dimension.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_DYNAMIC_DIMENSION_HPP
17 #define OPENKALMAN_DYNAMIC_DIMENSION_HPP
18 
19 
20 namespace OpenKalman
21 {
22 #ifndef __cpp_concepts
23  namespace detail
24  {
25  template<typename T, std::size_t N, typename = void>
26  struct is_dynamic_dimension : std::false_type {};
27 
28  template<typename T, std::size_t N>
29  struct is_dynamic_dimension<T, N, std::enable_if_t<indexible<T> and index_dimension_of<T, N>::value == dynamic_size>>
30  : std::true_type {};
31  }
32 #endif
33 
34 
39  template<typename T, std::size_t N>
40 #ifdef __cpp_concepts
41  concept dynamic_dimension = indexible<T> and (index_dimension_of_v<T, N> == dynamic_size);
42 #else
43  constexpr bool dynamic_dimension = detail::is_dynamic_dimension<T, N>::value;
44 #endif
45 
46 
47 } // namespace OpenKalman
48 
49 #endif //OPENKALMAN_DYNAMIC_DIMENSION_HPP
Definition: dynamic_dimension.hpp:26
Definition: tuple_reverse.hpp:103
The root namespace for OpenKalman.
Definition: basics.hpp:34
constexpr bool dynamic_dimension
Specifies that T&#39;s index N has a dimension defined at run time.
Definition: dynamic_dimension.hpp:43
constexpr std::size_t dynamic_size
A constant indicating that a size or index is dynamic.
Definition: global-definitions.hpp:33