OpenKalman
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-2025 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_COORDINATE_SIZE_OF_HPP
17 #define OPENKALMAN_COORDINATE_SIZE_OF_HPP
18 
19 #include <type_traits>
24 
26 {
32 #ifdef __cpp_concepts
33  template<pattern T>
34  struct dimension_of : std::integral_constant<std::size_t, dynamic_size> {};
35 #else
36  template<typename T, typename = void>
37  struct dimension_of {};
38 #endif
39 
40 
41 #ifndef __cpp_concepts
42  template<typename T>
43  struct dimension_of<T, std::enable_if_t<not values::fixed<decltype(get_dimension(std::declval<std::decay_t<T>>()))>>>
44  : std::integral_constant<std::size_t, dynamic_size> {};
45 #endif
46 
47 
48 #ifdef __cpp_concepts
49  template<pattern T> requires values::fixed<decltype(get_dimension(std::declval<std::decay_t<T>>()))>
50  struct dimension_of<T>
51 #else
52  template<typename T>
53  struct dimension_of<T, std::enable_if_t<values::fixed<decltype(get_dimension(std::declval<std::decay_t<T>>()))>>>
54 #endif
55  : std::integral_constant<std::size_t, values::to_number(get_dimension(std::decay_t<T>{}))> {};
56 
57 
61  template<typename T>
63 
64 
65 } // namespace OpenKalman::coordinates
66 
67 #endif //OPENKALMAN_COORDINATE_SIZE_OF_HPP
Definition for values::to_number.
Definition: tuple_reverse.hpp:103
The size of a coordinates::pattern.
Definition: dimension_of.hpp:37
constexpr auto get_dimension(const Arg &arg)
Get the vector dimension of coordinates::pattern Arg.
Definition: get_dimension.hpp:55
Definition: compares_with.hpp:28
constexpr auto dimension_of_v
Helper template for coordinates::dimension_of.
Definition: dimension_of.hpp:62
Definition for coordinates::get_dimension.
Definition for ::fixed.
constexpr bool fixed
T is a values::value that is determinable at compile time.
Definition: fixed.hpp:60
Global definitions for OpenKalman.