3 ms·
> If you don't use operator[], then you don't pay for it The feature you pay for without using it is copy on write, not []. In fact it's very clear in the pa
by masklinn 17y ago
> If you don't use operator[], then you don't pay for it
The feature you pay for without using it is copy on write, not [].
In fact it's very clear in the paragraph before the last chunk of code:
> If you do use these functions, you risk paying for a write that you don't make
- tedunangst 17y agoI should have made more clear I never really expected COW, so I'm not terribly disappointed when I don't get it. The standard allows but doesn't require it, IIRC. But I don't see how I ever "pay" for COW. It's cheaper than copying when it works. Or, like I said, if you want copies, it's because you want copies. If you just want cheap references, use references.