octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Complex mappers for real values


From: Dmitri A. Sergatskov
Subject: Re: Complex mappers for real values
Date: Wed, 21 Jun 2017 22:46:24 -0500



On Wed, Jun 21, 2017 at 10:40 PM, Rik <address@hidden> wrote:
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



​If you could make a self-contained test case i can try with clang 4

Dmitri.
--

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]