[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with std::complex::real implementation under MSVC
From: |
John W. Eaton |
Subject: |
Problem with std::complex::real implementation under MSVC |
Date: |
Wed, 29 Oct 2008 17:38:43 -0400 |
On 29-Oct-2008, Michael Goffioul wrote:
| Recently I tried to recompile octave with MSVC and
| notice a compilation error that is specific to MSVC,
| in lo-specfun.cc. Basically, the problem is that MSVC
| does not implement
|
| T& real (void)
|
| but
|
| T real (const T& val)
|
| instead. So for instance, you cannot write something
| like the following
|
| y.real () *= expz;
| y.imag () *= expz;
|
| In this specific case, you could simply use
|
| y *= expz
|
| because expz is float anyway. And you cannot write
|
| y.imag () = 0.0;
|
| but you could use
|
| y = std::complex (y.real (), 0.0);
|
| I can provide a complete patch, but would such changes
| be acceptable?
It's fine with me. I wasn't sure about the portability of my recent
changes and I only checked GNU libstdc++ headers. Sorry about not
doing a more thorough check.
Should we also prefer x.real () over real (x)? I guess it would be
nice to be somewhat consistent in our usage.
jwe