The forward iterator for Michael's list 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 (gc::HP, gc::HRC), a guard is limited resource per thread, so an exception (or assertion) "no free guard"
+ For some GC (\p gc::HP), a guard is limited resource per thread, so an exception (or assertion) "no free guard"
may be thrown if a limit of guard count per thread is exceeded.
- The iterator cannot be moved across thread boundary since it contains 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
template <typename K, typename Less>
bool erase_with( K const& key, Less pred )
{
+ CDS_UNUSED( pred );
return erase_at( head(), key, typename maker::template less_wrapper<Less>::type() );
}
void operator()(value_type& val) { ... }
};
\endcode
- The functor may be passed by reference with <tt>boost:ref</tt>
Return \p true if key is found and deleted, \p false otherwise
template <typename K, typename Less, typename Func>
bool erase_with( K const& key, Less pred, Func f )
{
+ CDS_UNUSED( pred );
return erase_at( head(), key, typename maker::template less_wrapper<Less>::type(), f );
}
template <typename K, typename Less>
bool extract_with( guarded_ptr& dest, K const& key, Less pred )
{
+ CDS_UNUSED( pred );
return extract_at( head(), dest.guard(), key, typename maker::template less_wrapper<Less>::type() );
}
template <typename Q, typename Less>
bool find_with( Q const& key, Less pred )
{
+ CDS_UNUSED( pred );
return find_at( head(), key, typename maker::template less_wrapper<Less>::type() );
}
\endcode
where \p item is the item found.
- You may pass \p f argument by reference using \p std::ref
-
The functor may change <tt>item.second</tt> that is reference to value of node.
Note that the function is only guarantee that \p item cannot be deleted during functor is executing.
The function does not serialize simultaneous access to the list \p item. If such access is
template <typename Q, typename Less, typename Func>
bool find_with( Q const& key, Less pred, Func f )
{
+ CDS_UNUSED( pred );
return find_at( head(), key, typename maker::template less_wrapper<Less>::type(), f );
}
template <typename K, typename Less>
bool get_with( guarded_ptr& ptr, K const& key, Less pred )
{
+ CDS_UNUSED( pred );
return get_at( head(), ptr.guard(), key, typename maker::template less_wrapper<Less>::type() );
}