tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
real.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_COMPLEX_REAL_HPP
4#define TETL_COMPLEX_REAL_HPP
5
9
10namespace etl {
11
13template <typename T>
14[[nodiscard]] constexpr auto real(complex<T> const& z) noexcept(noexcept(z.real())) -> T
15{
16 return z.real();
17}
18
20template <floating_point Float>
21[[nodiscard]] constexpr auto real(Float f) noexcept -> Float
22{
23 return f;
24}
25
27template <integral Integer>
28[[nodiscard]] constexpr auto real(Integer i) noexcept -> double
29{
30 return static_cast<double>(i);
31}
32
33} // namespace etl
34
35#endif // TETL_COMPLEX_REAL_HPP
constexpr auto real(complex< T > const &z) noexcept(noexcept(z.real())) -> T
Definition real.hpp:14
Definition adjacent_find.hpp:8
A complex number.
Definition complex.hpp:19