What would break if class was merged with struct

Moritz Maxeiner via Digitalmars-d digitalmars-d at puremagic.com
Sat May 27 11:37:39 PDT 2017


On Saturday, 27 May 2017 at 18:33:36 UTC, Ola Fosheim Grøstad 
wrote:
> On Saturday, 27 May 2017 at 18:21:41 UTC, Moritz Maxeiner wrote:
>> Then please don't call them "smart", because that term is 
>> specifically reserved for something that adds at least some 
>> additional features over a regular pointer (bounds checking, 
>> memory / lifetime management, etc.).
>
> "smart pointer" just means that it is a pointer wrapped in an 
> ADT. In this context it could provide allocation-information 
> would be one thing it could provide, or reference counting, 
> member access or whatever. The "smart" part was deliberately 
> left unspecified.

An ADT that adds features to the wrapped pointer; and if it adds 
features, it is not *just* a normal pointer anymore, i.e. you 
cannot use it as a verbatim replacement for normal class 
instances on the language level, because you change their 
semantics.


More information about the Digitalmars-d mailing list