[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Complex mappers for real values
From: |
Rik |
Subject: |
Complex mappers for real values |
Date: |
Wed, 21 Jun 2017 20:40:14 -0700 |
All,
Does anyone know if the following comment in lo-mappers.h still applies?
// C++ now provides versions of the following functions for arguments of
// type std::complex<T> and T. But some compilers (I'm looking at you,
// clang) apparently don't get this right yet... So we provide our own
// wrappers for real-valued arguments.
An example of how this expands into a lot of templates is shown below:
inline double conj (double x) { return x; }
inline float conj (float x) { return x; }
template <typename T>
std::complex<T>
conj (const std::complex<T>& x)
{
return std::conj (x);
}
According to the documentation for C++,
Additional overloads are provided for arguments of any fundamental
arithmetic type: In this case, the function assumes the value has a zero
imaginary component.
The return type is complex<double>, except if the argument is float or long
double (in which case, the return type is the complex instantiation for
that type: either complex<float> or complex<long double>).
I'd kind of be surprised if clang hasn't fixed themselves by now.
--Rik
- Complex mappers for real values,
Rik <=
- Re: Complex mappers for real values, Dmitri A. Sergatskov, 2017/06/21
- Re: Complex mappers for real values, Mike Miller, 2017/06/22
- Re: Complex mappers for real values, Mike Miller, 2017/06/22
- Re: Complex mappers for real values, Mike Miller, 2017/06/22
- Re: Complex mappers for real values, Dmitri A. Sergatskov, 2017/06/22
- Re: Complex mappers for real values, Mike Miller, 2017/06/22
- Re: Complex mappers for real values, Dmitri A. Sergatskov, 2017/06/22
- Re: Complex mappers for real values, Mike Miller, 2017/06/22
- Re: Complex mappers for real values, Rik, 2017/06/23