Immovable types
kinke via Digitalmars-d
digitalmars-d at puremagic.com
Wed Apr 19 01:52:45 PDT 2017
On Wednesday, 19 April 2017 at 02:53:18 UTC, Stanislav Blinov
wrote:
> But it is always assumed that a value can be moved.
It's not just assumed, it's a key requirement for structs in D,
as the compiler can move stuff automatically this way (making a
bitcopy and then eliding the postblit ctor for the new instance
and the destructor for the moved-from instance).
That is quite a different concept to C++, where a (non-elided)
special move ctor is required, moved-from instances need to be
reset so that their (non-elided) destructor doesn't free
moved-from resources etc.
More information about the Digitalmars-d
mailing list