Head Const

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 19 13:09:21 PST 2016


On 02/19/2016 03:46 PM, Iakh wrote:
> On Thursday, 18 February 2016 at 22:46:04 UTC, Walter Bright wrote:
>> On 2/18/2016 10:22 AM, Timon Gehr wrote:
>>> He wanted to embed a mutable reference count literally within a const
>>> object.
>>> Not a headconst object.
>>
>> I know. I pointed out how it could be done in a way to achieve the
>> same effect.
>>
>> BTW, shared_ptr<> uses a pointer to the ref count.
>
> Could D RefCounted!T be splitted into data (possibly immutable) and
> mutable metadata?

This is becoming an FAQ. I think someone should write a blog post about 
it. The basic problem here is composability is not possible with this 
approach. -- Andrei



More information about the Digitalmars-d mailing list