3 ms·
If you don't copy the resource then you are sharing it. This means you'll have reference semantics and every instance operates on the same resource. Value_ptr i
by entelechy 9y ago
If you don't copy the resource then you are sharing it.
This means you'll have reference semantics and every instance operates on the same resource. Value_ptr implements value semantics and so it behaves like primitives.
- masklinn 9y ago> If you don't copy the resource then you are sharing it. I think their point is more that the copy has an arbitrary complexity, so while you think you're copying a smart pointer you're triggering a possibly huge cascade behind the scenes. > This means you'll have reference semantics and every instance operates on the same resource You could have an explicit copy operation on an otherwise move-semantic smart pointer. No sharing, and while you get the ability to copy stuff if necessary it's not potentially hidden behind every argument passing or assignation, it becomes a very deliberate operation.