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_DIMENSION_OF_HPP
17 #define OPENKALMAN_DIMENSION_OF_HPP
18 
19 #include <type_traits>
20 #include "values/values.hpp"
23 
25 {
31 #ifdef __cpp_concepts
32  template<typename T>
33 #else
34  template<typename T, typename = void>
35 #endif
36  struct dimension_of {};
37 
38 
39 #ifdef __cpp_concepts
40  template<pattern T> requires requires(T&& t) { get_dimension(t); }
41  struct dimension_of<T>
42 #else
43  template<typename T>
44  struct dimension_of<T, std::void_t<decltype(get_dimension(std::declval<T>()))>>
45 #endif
46  : std::conditional_t<
47  values::fixed<decltype(get_dimension(std::declval<T>()))>,
48  values::fixed_value_of<decltype(get_dimension(std::declval<T>()))>,
49  std::integral_constant<std::size_t, stdex::dynamic_extent>> {};
50 
51 
55  template<typename T>
57 
58 
59 }
60 
61 #endif
Header file for code relating to values (e.g., scalars and indices)
constexpr auto dimension_of_v
Helper template for coordinates::dimension_of.
Definition: dimension_of.hpp:56
Definition for coordinates::pattern.
The size of a coordinates::pattern.
Definition: dimension_of.hpp:36
constexpr auto get_dimension(const Arg &arg)
Get the vector dimension of coordinates::pattern Arg.
Definition: get_dimension.hpp:54
The namespace for features relating to coordinates::pattern object.
Definition: compares_with.hpp:25
Definition for coordinates::get_dimension.