I agree with last sentence. I was using stl containers for quite some time before I even saw the Qt hello world example, I loved Qt and the benefits of its container classes, but still I'm using const references to pass QStrings, QImages etc. even if I know that its not really needed. Thats ok if I had to work with "regular" container classes.
But I really like the simplicity that comes with copy-on-write. If I had a choice, I think I'd use implicit shared containers instead of regular ones.
Code overhead ? You can write code that manages implicit shared data once, and then reuse it for most of your containers.adds code, memory and runtime overhead to your container classes
What do you mean with memory overhead, a pointer to data and integer counter ?I failed to see a big runtime overhead either.
In the end, it's your design decision. If you are implementing a set of classes only for yourself, you are free to do whatever you want. But if you want other programmers to use it, I guess more people will enjoy your code if its easy to use - and I think implicit sharing guarantees it.
Bookmarks