OpenKalman
get_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) 2022-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_GET_INDEX_DIMENSION_OF_HPP
17 #define OPENKALMAN_GET_INDEX_DIMENSION_OF_HPP
18 
19 
20 namespace OpenKalman
21 {
25 #ifdef __cpp_concepts
26  template<typename T, values::index N = std::integral_constant<std::size_t, 0>> requires
27  requires(T t, N n) { {get_vector_space_descriptor(t, n)} -> coordinates::pattern; }
28  constexpr values::index auto
29 #else
30  template<typename T, typename N = std::integral_constant<std::size_t, 0>, std::enable_if_t<
31  coordinates::pattern<decltype(get_vector_space_descriptor(std::declval<T>(), std::declval<N>()))>, int> = 0>
32  constexpr auto
33 #endif
34  get_index_dimension_of(const T& t, N n = N{})
35  {
36  return get_dimension(get_vector_space_descriptor(t, n));
37  }
38 
39 
43 #ifdef __cpp_concepts
44  template<std::size_t N, typename T> requires requires(T t) { {get_vector_space_descriptor<N>(t)} -> coordinates::pattern; }
45  constexpr values::index auto
46 #else
47  template<std::size_t N, typename T, std::enable_if_t<
48  coordinates::pattern<decltype(get_vector_space_descriptor<N>(std::declval<T>()))>, int> = 0>
49  constexpr auto
50 #endif
52  {
53  return get_dimension(get_vector_space_descriptor<N>(t));
54  }
55 
56 
57 } // namespace OpenKalman
58 
59 #endif //OPENKALMAN_GET_INDEX_DIMENSION_OF_HPP
The root namespace for OpenKalman.
Definition: basics.hpp:34
constexpr bool index
T is an index value.
Definition: index.hpp:56
constexpr auto get_index_dimension_of(const T &t, N n=N{})
Get the runtime dimensions of index N of indexible T.
Definition: get_index_dimension_of.hpp:34
constexpr auto get_vector_space_descriptor(const T &t, const N &n)
Get the coordinates::pattern object for index N of indexible object T.
Definition: get_vector_space_descriptor.hpp:56