OpenKalman
value_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) 2024-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_VALUE_TYPE_OF_HPP
17 #define OPENKALMAN_VALUES_VALUE_TYPE_OF_HPP
18 
19 #include <type_traits>
21 
22 namespace OpenKalman::values
23 {
27 #ifdef __cpp_concepts
28  template<typename T>
29 #else
30  template<typename T, typename = void>
31 #endif
32  struct value_type_of {};
33 
34 
36 #ifdef __cpp_concepts
37  template<typename T> requires requires(T t) { to_value_type(t); }
38  struct value_type_of<T>
39 #else
40  template<typename T>
41  struct value_type_of<T, std::void_t<decltype(to_value_type(std::declval<T>()))>>
42 #endif
43  {
44  using type = std::decay_t<decltype(to_value_type(std::declval<T>()))>;
45  };
46 
47 
51  template<typename T>
53 
54 }
55 
56 #endif
Obtain the underlying value type associated with a value.
Definition: value_type_of.hpp:32
typename value_type_of< T >::type value_type_of_t
Helper template for value_type_of.
Definition: value_type_of.hpp:52
Definition for values::to_value_type.
decltype(auto) constexpr to_value_type(Arg &&arg)
Convert, if necessary, a fixed or dynamic value to its underlying base type.
Definition: to_value_type.hpp:28
Definition for values::abs.
Definition: fixed-constants.hpp:23