A proof of concept of a semistable C++ vector container
4 days ago
- #Data Structures
- #C++
- #Iterator Stability
- semistable::vector provides iterator stability unlike std::vector, which invalidates iterators on insertions and erasures.
- It stores elements contiguously and maintains the same API as std::vector but with additional iterator stability guarantees.
- The library uses epoch descriptors to track changes, ensuring iterators adjust correctly when dereferenced.
- Performance benchmarks show semistable::vector operations are comparable to std::vector, with some optimizations possible using raw pointers.
- Thread safety is limited; concurrent iterator usage or modifications require precautions.
- The library is header-only, depends on Boost.Config, and requires C++11 or later.
- Future improvements could include better exception safety and detection of undefined iterator usage.