3 ms·
I think you have to say something about the copy semantics too, because if you ignore those, value_ptr would be synonymous with unique_ptr. class Tree { Tre
by waqf 9y ago
I think you have to say something about the copy semantics too, because if you ignore those, value_ptr would be synonymous with unique_ptr.
class Tree { Tree *_left, *_right; };
Tree y = x;
makes a shallow copy.
class Tree { unique_ptr<Tree> _left, _right; };
Tree y = x;
doesn't compile, but
class Tree { value_ptr<Tree> _left, _right; };
Tree y = x;
makes a deep copy.