A proof of concept of a semistable C++ vector container
Posted by joaquintides 4 days ago
Comments
Comment by shin_lao 9 hours ago
Comment by wavemode 9 hours ago
This "semistable" vector appears to only do the "allow appending while iterating" part, but still maintains a contiguous buffer by periodically moving its contents.
Comment by eps 7 hours ago
If the code here operates with a bit of data from some container, the container will ensure that this bit will persist until all references to it are gone even if the bit is removed from the container.
Depending on the datamodel this may be handy or even required. Consider some sort of hot-swappable code when both retired and new code versions running in parallel at some point. That sort of thing.
Comment by unnah 12 hours ago
Comment by thechao 13 hours ago
Comment by omoikane 9 hours ago
If I understand correctly:
thread safety random access stable iterators
------------- ------------- ----------------
std::list thread-compatible no yes
std::vector thread-compatible yes no
std::deque thread-compatible yes no
semistable::vector thread-unsafe yes yes
I think there are more times when I wanted concurrent reads and (random access OR stable iterators), than when I wanted both random access AND stable iterators but not concurrent reads. I wonder what's the intended application?