this(this) must be cheap and O(1)

Peter Alexander peter.alexander.au at gmail.com
Sun Sep 25 12:02:05 PDT 2011


On 25/09/11 7:37 PM, deadalnix wrote:
> Le 25/09/2011 04:52, Andrei Alexandrescu a écrit :
>> On 9/24/11 9:31 PM, Michel Fortin wrote:
>>> Perhaps I am missing the point. What would be gained by forcing
>>> this(this) to be nothrow?
>>
>> It further frees the standard library to cater for the throwing case.
>>
>> Andrei
>
> If I understand, what is explained in this thread is things that the
> standard lib can assume concerning this(this) ?
>
> So, in the end, I'm not disallowed to have an expensive this(this), but
> I should expect that the standard lib will not behave optimally in this
> case ?
>
> Or are we talking about some modification/restriction in the language ?

I believe it's just the library. There's no way the language could 
reasonably enforce it anyway.

It probably just means Phobos will do more copies than C++ would for 
example.


More information about the Digitalmars-d mailing list