octave-maintainers
[Top][All Lists]
Advanced

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

Re: C++ complex class use in str2double.cc


From: Michael Goffioul
Subject: Re: C++ complex class use in str2double.cc
Date: Mon, 1 Mar 2010 09:47:02 +0000

On Mon, Mar 1, 2010 at 9:03 AM, Jaroslav Hajek <address@hidden> wrote:
> On Sun, Feb 28, 2010 at 11:50 AM, Michael Goffioul
> <address@hidden> wrote:
>> While trying to compile str2double.cc with MSVC, it failed because
>> std::complex::real()
>> is used as an l-value, while in MSVC it's defined as "T real(void)
>> const". Is this a
>> C++ requirement to have a non-const version, or is it a GNU extension?
>>
>> Thanks,
>> Michael.
>>
>
> You're right, the standard only defines the const versions, though I
> believe this is a (minor) flaw in C++.
> I think the original reasoning was to allow a polar implementation,
> which would however be insane for a multitude of other reasons.
> Such an implementation would break Octave anyway.
>
> I added non-GNU code to str2double.

I had a look at your changeset. Can't you use the method
"void real(double val)" instead? This also exists in MSVC,
and seems to be part of the C++0x standard (i'm not an expert
here, I just found a working draft on the web), and supported
by libstdc++.

Michael.


reply via email to

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