//@endcond
public:
- typedef cds::urcu::exempt_ptr< gc, value_type, value_type, clear_and_dispose, void > exempt_ptr ; ///< pointer to extracted node
+ /// pointer to extracted node
+ using exempt_ptr = cds::urcu::exempt_ptr< gc, value_type, value_type, clear_and_dispose, void >;
protected:
//@cond
{
return get_const_begin();
}
- const_iterator cbegin()
+ const_iterator cbegin() const
{
return get_const_begin();
}
{
return get_const_end();
}
- const_iterator cend()
+ const_iterator cend() const
{
return get_const_end();
}
/**
\anchor cds_intrusive_LazyList_rcu_extract
The function searches an item with key equal to \p key in the list,
- unlinks it from the list, and returns pointer to an item found in \p dest parameter.
- If the item with the key equal to \p key is not found the function returns \p false,
- \p dest is empty.
+ unlinks it from the list, and returns \ref cds::urcu::exempt_ptr "exempt_ptr" pointer to an item found.
+ If the item is not found the function returns empty \p exempt_ptr.
@note The function does NOT call RCU read-side lock or synchronization,
and does NOT dispose the item found. It just excludes the item from the list
- and returns a pointer to item found.
- You should lock RCU before calling this function, and you should manually synchronize RCU
+ and returns a pointer to it.
+ You should manually lock RCU before calling this function, and you should manually synchronize RCU
outside the RCU lock region before reusing returned pointer.
\code
// Now, you can apply extract function
// Note that you must not delete the item found inside the RCU lock
- if ( theList.extract( p1, 10 )) {
+ p1 = theList.extract( 10 )
+ if ( p1 ) {
// do something with p1
...
}
\endcode
*/
template <typename Q>
- bool extract( exempt_ptr& dest, Q const& key )
+ exempt_ptr extract( Q const& key )
{
- dest = extract_at( &m_Head, key, key_comparator() );
- return !dest.empty();
+ return exempt_ptr( extract_at( &m_Head, key, key_comparator() ));
}
/// Extracts an item from the list using \p pred predicate for searching
\p pred must imply the same element order as \ref key_comparator.
*/
template <typename Q, typename Less>
- bool extract_with( exempt_ptr& dest, Q const& key, Less pred )
+ exempt_ptr extract_with( Q const& key, Less pred )
{
- dest = extract_at( &m_Head, key, cds::opt::details::make_comparator_from_less<Less>() );
- return !dest.empty();
+ return exempt_ptr( extract_at( &m_Head, key, cds::opt::details::make_comparator_from_less<Less>() ));
}
/// Finds the key \p key
\endcode
where \p item is the item found, \p key is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using \p std::ref.
-
The functor may change non-key fields of \p item.
While the functor \p f is calling the item found \p item is locked.
{
return find_at( const_cast<node_type *>( &m_Head ), key, key_comparator(), f );
}
+ //@cond
+ template <typename Q, typename Func>
+ bool find( Q const& key, Func f ) const
+ {
+ return find_at( const_cast<node_type *>(&m_Head), key, key_comparator(), f );
+ }
+ //@endcond
/// Finds the key \p key using \p pred predicate for searching
/**
{
return find_at( const_cast<node_type *>( &m_Head ), key, cds::opt::details::make_comparator_from_less<Less>(), f );
}
+ //@cond
+ template <typename Q, typename Less, typename Func>
+ bool find_with( Q const& key, Less pred, Func f ) const
+ {
+ return find_at( const_cast<node_type *>(&m_Head), key, cds::opt::details::make_comparator_from_less<Less>(), f );
+ }
+ //@endcond
/// Finds the key \p key
/** \anchor cds_intrusive_LazyList_rcu_find_val