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: Ben Abbott
Subject: Re: Complex mappers for real values
Date: Thu, 22 Jun 2017 11:58:37 +0800

On Jun 22, 2017, at 11:46 AM, Dmitri A. Sergatskov <address@hidden> wrote:

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.

I’m happy to test Apple’s clang as well.

clang -v
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix

Ben



reply via email to

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