//@endcond
public:
+ ///@name Forward iterators (only for debugging purpose)
+ //@{
+ /// Forward iterator
+ /**
+ The forward iterator for Michael's set has some features:
+ - it has no post-increment operator
+ - to protect the value, the iterator contains a GC-specific guard + another guard is required locally for increment operator.
+ For some GC (like as \p gc::HP), a guard is a limited resource per thread, so an exception (or assertion) "no free guard"
+ may be thrown if the limit of guard count per thread is exceeded.
+ - The iterator cannot be moved across thread boundary because it contains thread-private GC's guard.
+ - Iterator ensures thread-safety even if you delete the item the iterator points to. However, in case of concurrent
+ deleting operations there is no guarantee that you iterate all item in the set.
+ Moreover, a crash is possible when you try to iterate the next element that has been deleted by concurrent thread.
+
+ @warning Use this iterator on the concurrent container for debugging purpose only.
+
+ The iterator interface:
+ \code
+ class iterator {
+ public:
+ // Default constructor
+ iterator();
+
+ // Copy construtor
+ iterator( iterator const& src );
+
+ // Dereference operator
+ value_type * operator ->() const;
+
+ // Dereference operator
+ value_type& operator *() const;
+
+ // Preincrement operator
+ iterator& operator ++();
+
+ // Assignment operator
+ iterator& operator = (iterator const& src);
+
+ // Equality operators
+ bool operator ==(iterator const& i ) const;
+ bool operator !=(iterator const& i ) const;
+ };
+ \endcode
+ */
+
/// Forward iterator
typedef michael_set::details::iterator< bucket_type, false > iterator;
}
/// Returns a forward const iterator addressing the first element in a set
- //@{
const_iterator begin() const
{
return get_const_begin();
}
+
+ /// Returns a forward const iterator addressing the first element in a set
const_iterator cbegin() const
{
return get_const_begin();
}
- //@}
/// Returns an const iterator that addresses the location succeeding the last element in a set
- //@{
const_iterator end() const
{
return get_const_end();
}
+
+ /// Returns an const iterator that addresses the location succeeding the last element in a set
const_iterator cend() const
{
return get_const_end();
}
- //@}
+ //@}
private:
//@cond
//@endcond
public:
+ ///@name Forward iterators
+ //@{
/// Forward iterator
/**
The forward iterator for Michael's set is based on \p OrderedList forward iterator and has some features:
- it has no post-increment operator
- it iterates items in unordered fashion
+
+ The iterator interface:
+ \code
+ class iterator {
+ public:
+ // Default constructor
+ iterator();
+
+ // Copy construtor
+ iterator( iterator const& src );
+
+ // Dereference operator
+ value_type * operator ->() const;
+
+ // Dereference operator
+ value_type& operator *() const;
+
+ // Preincrement operator
+ iterator& operator ++();
+
+ // Assignment operator
+ iterator& operator = (iterator const& src);
+
+ // Equality operators
+ bool operator ==(iterator const& i ) const;
+ bool operator !=(iterator const& i ) const;
+ };
+ \endcode
*/
typedef michael_set::details::iterator< bucket_type, false > iterator;
}
/// Returns a forward const iterator addressing the first element in a set
- //@{
const_iterator begin() const
{
return get_const_begin();
}
+
+ /// Returns a forward const iterator addressing the first element in a set
const_iterator cbegin() const
{
return get_const_begin();
}
- //@}
/// Returns an const iterator that addresses the location succeeding the last element in a set
- //@{
const_iterator end() const
{
return get_const_end();
}
+
+ /// Returns an const iterator that addresses the location succeeding the last element in a set
const_iterator cend() const
{
return get_const_end();
}
- //@}
+ //@}
private:
//@cond
}
//@endcond
public:
+ ///@name Forward iterators (thread-safe under RCU lock)
+ //@{
/// Forward iterator
/**
The forward iterator for Michael's set is based on \p OrderedList forward iterator and has some features:
- it has no post-increment operator
- it iterates items in unordered fashion
- - The iterator cannot be moved across thread boundary since it may contain GC's guard that is thread-private GC data.
- - Iterator ensures thread-safety even if you delete the item that iterator points to. However, in case of concurrent
- deleting operations it is no guarantee that you iterate all item in the set.
- Therefore, the use of iterators in concurrent environment is not good idea. Use the iterator for the concurrent container
- for debug purpose only.
+ You may safely use iterators in multi-threaded environment only under RCU lock.
+ Otherwise, a crash is possible if another thread deletes the element the iterator points to.
+
+ The iterator interface:
+ \code
+ class iterator {
+ public:
+ // Default constructor
+ iterator();
+
+ // Copy construtor
+ iterator( iterator const& src );
+
+ // Dereference operator
+ value_type * operator ->() const;
+
+ // Dereference operator
+ value_type& operator *() const;
+
+ // Preincrement operator
+ iterator& operator ++();
+
+ // Assignment operator
+ iterator& operator = (iterator const& src);
+
+ // Equality operators
+ bool operator ==(iterator const& i ) const;
+ bool operator !=(iterator const& i ) const;
+ };
+ \endcode
*/
typedef michael_set::details::iterator< bucket_type, false > iterator;
}
/// Returns a forward const iterator addressing the first element in a set
- //@{
const_iterator begin() const
{
return get_const_begin();
}
+
+ /// Returns a forward const iterator addressing the first element in a set
const_iterator cbegin() const
{
return get_const_begin();
}
- //@}
/// Returns an const iterator that addresses the location succeeding the last element in a set
- //@{
const_iterator end() const
{
return get_const_end();
}
+
+ /// Returns an const iterator that addresses the location succeeding the last element in a set
const_iterator cend() const
{
return get_const_end();
}
- //@}
+ //@}
private:
//@cond
The forward iterator for Michael's set is based on \p OrderedList forward iterator and has some features:
- it has no post-increment operator
- it iterates items in unordered fashion
- - The iterator cannot be moved across thread boundary since it may contain GC's guard that is thread-private GC data.
+ - The iterator cannot be moved across thread boundary because it may contain GC's guard that is thread-private GC data.
- Iterator ensures thread-safety even if you delete the item that iterator points to. However, in case of concurrent
deleting operations it is no guarantee that you iterate all item in the set.
Moreover, a crash is possible when you try to iterate the next element that has been deleted by concurrent thread.
The forward iterator for Michael's set is based on \p OrderedList forward iterator and has some features:
- it has no post-increment operator
- it iterates items in unordered fashion
+
+ The iterator interface:
+ \code
+ class iterator {
+ public:
+ // Default constructor
+ iterator();
+
+ // Copy construtor
+ iterator( iterator const& src );
+
+ // Dereference operator
+ value_type * operator ->() const;
+
+ // Dereference operator
+ value_type& operator *() const;
+
+ // Preincrement operator
+ iterator& operator ++();
+
+ // Assignment operator
+ iterator& operator = (iterator const& src);
+
+ // Equality operators
+ bool operator ==(iterator const& i ) const;
+ bool operator !=(iterator const& i ) const;
+ };
+ \endcode
*/
typedef michael_set::details::iterator< bucket_type, false > iterator;
You may safely use iterators in multi-threaded environment only under RCU lock.
Otherwise, a crash is possible if another thread deletes the element the iterator points to.
+
+ The iterator interface:
+ \code
+ class iterator {
+ public:
+ // Default constructor
+ iterator();
+
+ // Copy construtor
+ iterator( iterator const& src );
+
+ // Dereference operator
+ value_type * operator ->() const;
+
+ // Dereference operator
+ value_type& operator *() const;
+
+ // Preincrement operator
+ iterator& operator ++();
+
+ // Assignment operator
+ iterator& operator = (iterator const& src);
+
+ // Equality operators
+ bool operator ==(iterator const& i ) const;
+ bool operator !=(iterator const& i ) const;
+ };
+ \endcode
*/
typedef michael_set::details::iterator< bucket_type, false > iterator;