How to break const

Timon Gehr timon.gehr at gmx.ch
Tue Jun 19 10:37:58 PDT 2012


On 06/19/2012 07:18 PM, Christophe Travert wrote:
> Timon Gehr , dans le message (digitalmars.D:170178), a écrit :
>> That is completely unrelated.
>> It is impossible to justify transitivity of const for delegate context
>> pointers using this argument. It is far too general and the
>> justification for the general concept comes from a specific example
>> that is different from the one at hand.
>>
>> The question is, what the meaning of 'const' references should be:
>>
>> 1. data cannot be changed transitively through the reference
>>
>> 2. the reference can reference both 'const' and 'immutable' data and
>>      'immutable' data can transitively not be changed through the
>>      reference.
>>
>>
>> 1. requires transitive const for delegate context pointers, 2. does not.
>
> A const reference can contain
>
> I don't understand the difference.
>
> ...

In 2., mutable data referred to by a const reference might be changed 
through it.


More information about the Digitalmars-d mailing list