2 ms·
You can also use an offset instead of a pointer (or a pointer to the object and and an offset into its heap storage, or whatever).
by einpoklum 5y ago
You can also use an offset instead of a pointer (or a pointer to the object and and an offset into its heap storage, or whatever).
- _huayra_ 5y agoThis is actually on my list of "neat utilities to write": an iterator that encapsulates this "offset" for vector. If anyone is looking to write a custom iterator, I definitely recommend Boost's new stl interfaces: https://github.com/boostorg/stl_interfaces https://github.com/boostorg/stl_interfaces
- nly 5y agoOr you could just use Boost stable_vector and save yourself the trouble https://www.boost.org/doc/libs/1_76_0/doc/html/boost/container/stable_vector.html https://www.boost.org/doc/libs/1_76_0/doc/html/boost/contain...