In the context of
, in the end (section: strong programming),
To prevent processing leaks, always free resources (such as memory, file handles and sockets) in transferred assignment operators
If the transferred assignment is implemented instead:
Memory block & amp; Operator = (memoryblock and other) {if (it! = And others) {std :: swap (_data, other._data); Std :: swap (_length, other._length); } Return * This; }
Will not the "_data" of Rava, when it will exit from the other realm?
Yes,
other._data will be free when it is outside the scope (Considered a good disaster for the course) though there is one item to consider: If
refers to another ._data for a resource for which on time of destruction If required, then it can be destroyed in late design. An example may be a locked position of a mute x.
Comments
Post a Comment