- template <typename Q, typename Compare>
- guarded_ptr get_with_( Q const& val, Compare cmp )
- {
- guarded_ptr gp;
- if ( find_with_( val, cmp, [&gp](value_type& found, Q const& ) { gp.reset(&found); } ))
- return gp;
- return guarded_ptr();
- }
-
- template <typename Q, typename Compare, typename Func>
- bool erase_( Q const& val, Compare cmp, Func f )
- {
- position pos;
-
- if ( !find_position( val, pos, cmp, false )) {
- m_Stat.onEraseFailed();
- return false;
- }
-
- node_type * pDel = pos.pCur;
- typename gc::Guard gDel;
- gDel.assign( node_traits::to_value_ptr(pDel));
- assert( cmp( *node_traits::to_value_ptr( pDel ), val ) == 0 );
-
- unsigned int nHeight = pDel->height();
- if ( try_remove_at( pDel, pos, f )) {
- --m_ItemCounter;
- m_Stat.onRemoveNode( nHeight );
- m_Stat.onEraseSuccess();
- return true;
- }
-
- m_Stat.onEraseFailed();
- return false;
- }
-
- template <typename Q, typename Compare>
- guarded_ptr extract_( Q const& val, Compare cmp )
- {
- position pos;
+ /// Extracts the item from the set with specified \p key
+ /** \anchor cds_intrusive_SkipListSet_hp_extract
+ The function searches an item with key equal to \p key in the set,
+ unlinks it from the set, and returns it as \p guarded_ptr object.
+ If \p key is not found the function returns an empty guarded pointer.