OpenKalman
real.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) 2023-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_REAL_HPP
17 #define OPENKALMAN_VALUES_REAL_HPP
18 
22 
23 namespace OpenKalman::values
24 {
33 #ifdef __cpp_concepts
34  template<value Arg>
35  constexpr value auto
36 #else
37  template<typename Arg, std::enable_if_t<value<Arg>, int> = 0>
38  constexpr auto
39 #endif
40  real(const Arg& arg)
41  {
42  if constexpr (fixed<Arg>)
43  {
44  struct Op { constexpr auto operator()(const value_type_of_t<Arg>& a) const { return values::real(a); } };
45  return values::operation(Op{}, arg);
46  }
47  else
48  {
50  }
51  }
52 
53 
54 }
55 
56 
57 #endif
typename value_type_of< T >::type value_type_of_t
Helper template for value_type_of.
Definition: value_type_of.hpp:52
constexpr bool value
T is a fixed or dynamic value that is reducible to a number.
Definition: value.hpp:45
constexpr auto real(const Arg &arg)
A constexpr function to obtain the real part of a (complex) number.
Definition: real.hpp:40
Definition for values::abs.
Definition: fixed-constants.hpp:23
Definition for ::fixed.
Definition: number_traits.hpp:36
constexpr auto operation(Operation &&op, Args &&...args)
A potentially constant-evaluated operation involving some number of values.
Definition: operation.hpp:98
Definition for values::value.