OpenKalman
index.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) 2024 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_VALUES_INDEX_HPP
17 #define OPENKALMAN_VALUES_INDEX_HPP
18 
19 #include <type_traits>
22 #include "integral.hpp"
23 
24 namespace OpenKalman::values
25 {
26 #ifndef __cpp_concepts
27  namespace detail
28  {
29  template<typename T, typename = void>
30  struct number_type_is_unsigned : std::false_type {};
31 
32  template<typename T>
33  struct number_type_is_unsigned<T, std::enable_if_t<std::is_unsigned_v<value_type_of_t<T>>>>
34  : std::true_type {};
35 
36 
37  template<typename T, typename = void>
38  struct fixed_integral_gt_0 : std::false_type {};
39 
40  template<typename T>
41  struct fixed_integral_gt_0<T, std::enable_if_t<(fixed_value_of<T>::value >= 0)>> : std::true_type {};
42 
43 
44  template<typename T, typename = void>
45  struct is_bool : std::false_type {};
46 
47  template<typename T>
48  struct is_bool<T, std::enable_if_t<std::is_same_v<value_type_of_t<T>, bool>>> : std::true_type {};
49  }
50 #endif
51 
52 
56 #ifdef __cpp_concepts
57  template<typename T>
58  concept index = integral<T> and (std::is_unsigned_v<value_type_of_t<T>> or fixed_value_of<T>::value >= 0) and
59  (not std::same_as<value_type_of_t<T>, bool>);
60 #else
61  template<typename T>
64 #endif
65 
66 }
67 
68 #endif
typename value_type_of< T >::type value_type_of_t
Helper template for value_type_of.
Definition: value_type_of.hpp:52
The fixed value associated with a fixed.
Definition: fixed_value_of.hpp:44
Definition for value:value_type_of and value:value_type_of_t.
Definition for values::abs.
Definition: fixed-constants.hpp:23
Definition for values::fixed_value_of.
Definition for values::integral.
constexpr bool index
T is an index value.
Definition: index.hpp:62
Definition: index.hpp:45