xenium
Public Member Functions | List of all members
xenium::harris_michael_list_based_set< Key, Policies >::iterator Class Reference

A ForwardIterator to safely iterate the list. More...

#include <harris_michael_list_based_set.hpp>

Public Member Functions

iteratoroperator++ ()
 Moves the iterator to the next element. In the absence of conflicting operations, this operation has constant runtime complexity. However, in case of conflicting erase operations we might have to rescan the list to help remove the node and find the next element. More...
 
void reset ()
 Resets the iterator; this is equivalent to assigning end() to it. More...
 

Detailed Description

template<class Key, class... Policies>
class xenium::harris_michael_list_based_set< Key, Policies >::iterator

A ForwardIterator to safely iterate the list.

Iterators are not invalidated by concurrent insert/erase operations. However, conflicting erase operations can have a negative impact on the performance when advancing the iterator, because it may be necessary to rescan the list to find the next element.

Note: This iterator class does not provide multi-pass guarantee as a == b does not imply ++a == ++b.

Note: Each iterator internally holds two guard_ptr instances. This has to be considered when using a reclamation scheme that requires per-instance resources like hazard_pointer or hazard_eras. It is therefore highly recommended to use prefix increments wherever possible.

Member Function Documentation

◆ operator++()

template<class Key , class... Policies>
auto xenium::harris_michael_list_based_set< Key, Policies >::iterator::operator++

Moves the iterator to the next element. In the absence of conflicting operations, this operation has constant runtime complexity. However, in case of conflicting erase operations we might have to rescan the list to help remove the node and find the next element.

Progress guarantess: lock-free

◆ reset()

template<class Key , class... Policies>
void xenium::harris_michael_list_based_set< Key, Policies >::iterator::reset ( )
inline

Resets the iterator; this is equivalent to assigning end() to it.

This operation can be handy in situations where an iterator is no longer needed and you want to ensure that the internal guard_ptr instances are reset.