OpenKalman
one_dimensional.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_ONE_DIMENSIONAL_HPP
17 #define OPENKALMAN_ONE_DIMENSIONAL_HPP
18 
21 
22 namespace OpenKalman
23 {
24  namespace detail
25  {
26  template<typename T, applicability b, std::size_t...is>
27  constexpr auto
28  one_dimensional_fixed_index_count(std::index_sequence<is...>)
29  {
30  return (... and (dimension_size_of_index_is<T, is, 1, &stdex::is_eq, b>));
31  }
32 
33 
34  template<typename T, applicability b>
35  constexpr auto
36  one_dimensional_impl()
37  {
38  if constexpr (not indexible<T>) // only needed in c++17 mode
39  return false;
40  else if constexpr (index_count_v<T> == stdex::dynamic_extent)
41  return b == applicability::permitted;
42  else
43  return detail::one_dimensional_fixed_index_count<T, b>(std::make_index_sequence<index_count_v<T>>{});
44  }
45  }
46 
47 
52  template<typename T, applicability b = applicability::guaranteed>
53 #ifdef __cpp_concepts
54  concept one_dimensional =
55 #else
56  constexpr inline bool one_dimensional =
57 #endif
58  indexible<T> and
59  detail::one_dimensional_impl<T, b>();
60 
61 
62 }
63 
64 #endif
constexpr bool one_dimensional
Specifies that a type is one-dimensional in every index.
Definition: one_dimensional.hpp:56
applicability
The applicability of a concept, trait, or restraint.
Definition: constants.hpp:35
The concept, trait, or restraint is permitted, but whether it applies is not necessarily known at com...
Definition for dimension_size_of_index_is.
The root namespace for OpenKalman.
Definition: basics.hpp:34
Definition for index_count.
Definition: trait_backports.hpp:64