OpenKalman
complex_type_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) 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_VALUES_COMPLEX_TYPE_OF_T_HPP
17 #define OPENKALMAN_VALUES_COMPLEX_TYPE_OF_T_HPP
18 
19 #include <type_traits>
23 
24 namespace OpenKalman::values
25 {
33 #ifdef __cpp_concepts
34  template<typename T>
35 #else
36  template<typename T, typename = void, typename = void>
37 #endif
38  struct complex_type_of {};
39 
40 
42 #ifdef __cpp_concepts
43  template<value T> requires requires { internal::make_complex_number<value_type_of_t<T>>(std::declval<T>()); }
44  struct complex_type_of<T>
45 #else
46  template<typename T>
47  struct complex_type_of<T, std::enable_if_t<value<T>>,
48  std::void_t<decltype(internal::make_complex_number<value_type_of_t<T>>(std::declval<T>()))>>
49 #endif
50  {
51  using type = std::decay_t<decltype(internal::make_complex_number<value_type_of_t<T>>(std::declval<T>()))>;
52  };
53 
54 
58  template<typename T>
59  using complex_type_of_t = typename complex_type_of<T>::type;
60 
61 }
62 
63 #endif
Definition for value:value_type_of and value:value_type_of_t.
Definition for values::abs.
Definition: fixed-constants.hpp:23
Definition for values::value.