OpenKalman
dynamic.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_VALUE_DYNAMIC_HPP
17 #define OPENKALMAN_VALUE_DYNAMIC_HPP
18 
19 #include <type_traits>
20 #include "number.hpp"
21 #include "fixed.hpp"
22 
23 namespace OpenKalman::values
24 {
25 #ifndef __cpp_concepts
26  namespace internal
27  {
28  // This functions is also used in values::to_number
29 
30  template<typename T, typename = void>
31  struct is_dynamic : std::false_type {};
32 
33  template<typename T>
34  struct is_dynamic<T, std::enable_if_t<values::number<typename std::invoke_result<T>::type>>>
35  : std::true_type {};
36 
37  } // namespace internal
38 #endif
39 
40 
44  template<typename T>
45 #ifdef __cpp_concepts
46  concept dynamic = (not values::fixed<T>) and (values::number<T> or requires(std::decay_t<T> t){ {t()} -> values::number; });
47 #else
48  constexpr bool dynamic =
49  (not values::fixed<T>) and (values::number<T> or internal::is_dynamic<std::decay_t<T>>::value);
50 #endif
51 
52 
53 } // namespace OpenKalman::values
54 
55 #endif //OPENKALMAN_VALUE_DYNAMIC_HPP
constexpr bool number
T is a numerical type.
Definition: number.hpp:33
Definition: tuple_reverse.hpp:103
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31
Definition for values::abs.
Definition: constant_coefficient.hpp:25
constexpr bool dynamic
T is a values::value that is not determinable at compile time.
Definition: dynamic.hpp:48
Definition for ::fixed.
Definition for values::number.