OpenKalman
index_dimension_of.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_INDEX_DIMENSION_OF_HPP
17 #define OPENKALMAN_INDEX_DIMENSION_OF_HPP
18 
20 
21 namespace OpenKalman
22 {
30 #ifdef __cpp_concepts
31  template<typename T, std::size_t N = 0>
32 #else
33  template<typename T, std::size_t N = 0, typename = void>
34 #endif
35  struct index_dimension_of {};
36 
37 
38 #ifdef __cpp_concepts
39  template<indexible T, std::size_t N>
40  struct index_dimension_of<T, N>
41 #else
42  template<typename T, std::size_t N>
43  struct index_dimension_of<T, N, std::enable_if_t<indexible<T>>>
44 #endif
45  : std::integral_constant<std::size_t, coordinates::dimension_of_v<decltype(get_index_pattern<N>(std::declval<T>()))>> {};
46 
47 
51  template<typename T, std::size_t N = 0>
52  static constexpr auto index_dimension_of_v = index_dimension_of<T, N>::value;
53 
54 
55 }
56 
57 #endif
The root namespace for OpenKalman.
Definition: basics.hpp:34
Definition of get_index_pattern function.
The dimension of an index for a matrix, expression, or array.
Definition: index_dimension_of.hpp:35