OpenKalman
dimension_size_of_index_is.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_DIMENSION_SIZE_OF_INDEX_IS_HPP
17 #define OPENKALMAN_DIMENSION_SIZE_OF_INDEX_IS_HPP
18 
19 
20 namespace OpenKalman
21 {
22 #ifndef __cpp_concepts
23  namespace detail
24  {
25  template<typename T, std::size_t index, std::size_t value, typename = void>
26  struct dimension_size_of_index_is_impl : std::false_type {};
27 
28  template<typename T, std::size_t index, std::size_t value>
29  struct dimension_size_of_index_is_impl<T, index, value, std::enable_if_t<
30  index_dimension_of<T, index>::value == value>> : std::true_type {};
31  }
32 #endif
33 
34 
40  template<typename T, std::size_t index, std::size_t value, Applicability b = Applicability::guaranteed>
41 #ifdef __cpp_concepts
42  concept dimension_size_of_index_is = (index_dimension_of_v<T, index> == value) or
43 #else
44  constexpr bool dimension_size_of_index_is = detail::dimension_size_of_index_is_impl<T, index, value>::value or
45 #endif
46  (b == Applicability::permitted and (value == dynamic_size or dynamic_dimension<T, index>));
47 
48 
49 } // namespace OpenKalman
50 
51 #endif //OPENKALMAN_DIMENSION_SIZE_OF_INDEX_IS_HPP
constexpr bool dimension_size_of_index_is
Specifies that a given index of T has a specified size.
Definition: dimension_size_of_index_is.hpp:44
Definition: tuple_reverse.hpp:103
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31
The root namespace for OpenKalman.
Definition: basics.hpp:34
The concept, trait, or restraint is permitted, but whether it applies is not necessarily known at com...
Definition: dimension_size_of_index_is.hpp:26
constexpr std::size_t dynamic_size
A constant indicating that a size or index is dynamic.
Definition: global-definitions.hpp:33
constexpr bool index
An object describing a collection of /ref values::index objects.
Definition: index.hpp:75