Boost logo

Boost :

Subject: Re: [boost] Determining interest: Pure imaginary number library
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-11-18 11:56:13


Le 18/11/11 16:51, Neal Becker a écrit :
> Vicente Botet wrote:
>
> ...
>> Some comments related to the interface. I will replace
>>
>> T& imag();
>> const T& imag() const;
>>
>> by
>>
>> T imag() const;
>>
>> As there is no reason to provide non-const access to the internal
>> representation.
>>
> I disagree - there is a use to provide non-const access. Unless it happens that
> the internal representation is not obvious.
>
>
What this non-const conversion allows?

imaginary i;
i.imag() = 3.0;

Do you really think that

i = imag(3.0);

is less efficient or clear?

Am I missing something?

Best,
Vicente


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk