Calling anchor()
guarantees that this iterator can be used as the end of a range, without
danger of problems due to concurrent calls to insert_or_replace()
or erase()
on the map. If anchor()
has not been called for a given
iterator
, then comparisons
of that iterator with another will throw jss::concurrent_modification
if
the node referenced by that iterator has been deleted from the map.
This is of specialized use: since the map is unordered, iteration across
subranges is tricky, as the order of elements is not guaranteed. The
iterator returned from end()
is always an anchor.
void anchor();
Anchors the current node.
std::bad_alloc
if the memory required
to store the anchor information could not be allocated.
#include <jss/concurrent_map.hpp>