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 
19 
20 namespace OpenKalman
21 {
29 #ifdef __cpp_concepts
30  template<typename T, std::size_t N = 0>
31 #else
32  template<typename T, std::size_t N = 0, typename = void>
33 #endif
34  struct index_dimension_of {};
35 
36 
37  template<typename T, std::size_t N>
38 #ifdef __cpp_concepts
39  requires requires { typename vector_space_descriptor_of_t<T, N>; }
40  struct index_dimension_of<T, N>
41 #else
42  struct index_dimension_of<T, N, std::void_t<typename vector_space_descriptor_of<T, N>::type>>
43 #endif
44  : std::integral_constant<std::size_t, coordinates::dimension_of_v<vector_space_descriptor_of_t<T, N>>> {};
45 
46 
50  template<typename T, std::size_t N = 0>
51  static constexpr auto index_dimension_of_v = index_dimension_of<T, N>::value;
52 
53 
54 } // namespace OpenKalman
55 
56 #endif //OPENKALMAN_INDEX_DIMENSION_OF_HPP
Definition: tuple_reverse.hpp:103
The root namespace for OpenKalman.
Definition: basics.hpp:34
typename vector_space_descriptor_of< T, N >::type vector_space_descriptor_of_t
helper template for vector_space_descriptor_of.
Definition: vector_space_descriptor_of.hpp:56
The dimension of an index for a matrix, expression, or array.
Definition: index_dimension_of.hpp:34