Const-correctness and uniqueness. Again.

via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 9 07:15:34 PST 2015


On Monday, 9 February 2015 at 13:19:24 UTC, Tobias Pankrath wrote:
> On Monday, 9 February 2015 at 12:39:06 UTC, Marc Schütz wrote:
>> On Monday, 9 February 2015 at 11:38:23 UTC, Jakob Ovrum wrote:
>>> On Monday, 9 February 2015 at 11:37:23 UTC, Jakob Ovrum wrote:
>>>> std.array.join is strongly pure (with appropriate template 
>>>> arguments), so its return value is implicitly convertible to 
>>>> immutable.
>>>
>>> Err, implicitly convertible to *mutable*. It goes both ways.
>>
>> It does? Not according to my tests. And it would be bad if it 
>> did, because the returned immutable value could actually 
>> reside in read-only memory.
>
> join returns a mutable array, that can be implicitly casted to 
> immutable if join is pure.

I'm talking about the general case. Jacob seems to be saying that 
a unique _immutable_ value is implicitly convertible to mutable.


More information about the Digitalmars-d mailing list