Ruling out arbitrary cost copy construction?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Oct 6 15:45:20 PDT 2010


On 10/6/10 16:30 CDT, Nick Sabalausky wrote:
> "Andrei Alexandrescu"<SeeWebsiteForEmail at erdani.org>  wrote in message
> news:i8ioif$1rl3$1 at digitalmars.com...
>> On 10/6/10 16:02 CDT, Nick Sabalausky wrote:
>>> So you want to simplify usage of sealed ranges by forcing all classes
>>> that
>>> allocate in their ctor to be reference counted classes instead of GCed?
>>
>> Almost. Rephrased just a bit:
>>
>> "So you want to simplify usage of sealed ranges by forcing all structs
>> that allocate in their this(this) to use reference counted internally
>> instead of eager copying?"
>>
>> Yes :o).
>>
>
> Ok. And that means reference counting on the memory the struct allocates in
> this(this) (and not on all uses of the struct itself)?

That is correct.

I should emphasize that this is in all likelihood going to be a 
contentious point to C++ programmers used to eager copy semantics. 
Reference counting is robust and often economical, but adds hoops to the 
implementation - each method of the struct must redirect through the 
refcounted handle and duplicate it if necessary etc.

I fear that it would be windfall for nitpickers, who in turn will 
influence anyone who likes to worry.


Andrei



More information about the Digitalmars-d mailing list