#define __CDS_CONTAINER_BASKET_QUEUE_H
#include <memory>
+#include <functional> // ref
#include <cds/intrusive/basket_queue.h>
#include <cds/container/details/base.h>
-#include <cds/ref.h>
#include <cds/details/trivial_assign.h>
-
namespace cds { namespace container {
//@cond
bool enqueue( const Type& data, Func f )
{
scoped_node_ptr p( alloc_node());
- cds::unref(f)( p->m_value, data );
+ f( p->m_value, data );
if ( base_class::enqueue( *p )) {
p.release();
return true;
{
typename base_class::dequeue_result res;
if ( base_class::do_dequeue( res, true )) {
- cds::unref(f)( dest, node_traits::to_value_ptr( *res.pNext )->m_value );
+ f( dest, node_traits::to_value_ptr( *res.pNext )->m_value );
return true;
}
return false;
- <tt>item.first</tt> is a const reference to item's key that cannot be changed.
- <tt>item.second</tt> is a reference to item's value that may be changed.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if inserting is successful.
The key_type should be constructible from value of type \p K.
bool insert_key( const K& key, Func func )
{
scoped_node_ptr pNode( alloc_node( key ));
- if ( base_class::insert( *pNode, [&func]( node_type& item ) { cds::unref(func)( item.m_val ); } )) {
+ if ( base_class::insert( *pNode, [&func]( node_type& item ) { func( item.m_val ); } )) {
pNode.release();
return true;
}
The functor may change any fields of the \p item.second that is \ref value_type.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
{
scoped_node_ptr pNode( alloc_node( key ));
std::pair<bool, bool> res = base_class::ensure( *pNode,
- [&func](bool bNew, node_type& item, node_type const& ){ cds::unref(func)( bNew, item.m_val ); }
+ [&func](bool bNew, node_type& item, node_type const& ){ func( bNew, item.m_val ); }
);
if ( res.first && res.second )
pNode.release();
{
node_type * pNode = base_class::erase( key );
if ( pNode ) {
- cds::unref(f)( pNode->m_val );
+ f( pNode->m_val );
free_node( pNode );
return true;
}
{
node_type * pNode = base_class::erase_with( key, cds::details::predicate_wrapper<node_type, Predicate, key_accessor>() );
if ( pNode ) {
- cds::unref(f)( pNode->m_val );
+ f( pNode->m_val );
free_node( pNode );
return true;
}
\endcode
where \p item is the item found.
- You can pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by reference using \p std::ref
The functor may change \p item.second.
template <typename K, typename Func>
bool find( K const& key, Func f )
{
- return base_class::find( key, [&f](node_type& item, K const& ) { cds::unref(f)( item.m_val );});
+ return base_class::find( key, [&f](node_type& item, K const& ) { f( item.m_val );});
}
/// Find the key \p val using \p pred predicate for comparing
bool find_with( K const& key, Predicate pred, Func f )
{
return base_class::find_with( key, cds::details::predicate_wrapper<node_type, Predicate, key_accessor>(),
- [&f](node_type& item, K const& ) { cds::unref(f)( item.m_val );});
+ [&f](node_type& item, K const& ) { f( item.m_val );});
}
/// Find the key \p key
Therefore, the \p value_type should be constructible from type \p Q.
The user-defined functor is called only if the inserting is success. It can be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
*/
template <typename Q, typename Func>
bool insert( Q const& val, Func f )
{
scoped_node_ptr pNode( alloc_node( val ));
- if ( base_class::insert( *pNode, [&f]( node_type& node ) { cds::unref(f)( node.m_val ); } )) {
+ if ( base_class::insert( *pNode, [&f]( node_type& node ) { f( node.m_val ); } )) {
pNode.release();
return true;
}
The functor can change non-key fields of the \p item.
- You can pass \p func argument by value or by reference using <tt>boost::ref</tt>.
+ You can pass \p func argument by value or by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p val key
{
scoped_node_ptr pNode( alloc_node( val ));
std::pair<bool, bool> res = base_class::ensure( *pNode,
- [&val,&func](bool bNew, node_type& item, node_type const& ){ cds::unref(func)( bNew, item.m_val, val ); }
+ [&val,&func](bool bNew, node_type& item, node_type const& ){ func( bNew, item.m_val, val ); }
);
if ( res.first && res.second )
pNode.release();
{
node_type * pNode = base_class::erase( key );
if ( pNode ) {
- cds::unref(f)( pNode->m_val );
+ f( pNode->m_val );
free_node( pNode );
return true;
}
{
node_type * pNode = base_class::erase_with( key, typename maker::template predicate_wrapper<Predicate, bool>() );
if ( pNode ) {
- cds::unref(f)( pNode->m_val );
+ f( pNode->m_val );
free_node( pNode );
return true;
}
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref
The functor can change non-key fields of \p item.
The \p val argument is non-const since it can be used as \p f functor destination i.e., the functor
template <typename Q, typename Func>
bool find( Q& val, Func f )
{
- return base_class::find( val, [&f](node_type& item, Q& v) { cds::unref(f)( item.m_val, v );});
+ return base_class::find( val, [&f](node_type& item, Q& v) { f( item.m_val, v );});
}
/// Find the key \p val using \p pred predicate for comparing
bool find_with( Q& val, Predicate pred, Func f )
{
return base_class::find_with( val, typename maker::template predicate_wrapper<Predicate, bool>(),
- [&f](node_type& item, Q& v) { cds::unref(f)( item.m_val, v );});
+ [&f](node_type& item, Q& v) { f( item.m_val, v );});
}
/// Find the key \p val
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref
The functor can change non-key fields of \p item.
template <typename Q, typename Func>
bool find( Q const& val, Func f )
{
- return base_class::find( val, [&f](node_type& item, Q const& v) { cds::unref(f)( item.m_val, v );});
+ return base_class::find( val, [&f](node_type& item, Q const& v) { f( item.m_val, v );});
}
/// Find the key \p val using \p pred predicate for comparing
bool find_with( Q const& val, Predicate pred, Func f )
{
return base_class::find_with( val, typename maker::template predicate_wrapper<Predicate, bool>(),
- [&f](node_type& item, Q const& v) { cds::unref(f)( item.m_val, v );});
+ [&f](node_type& item, Q const& v) { f( item.m_val, v );});
}
/// Find the key \p val
namespace details {
-#ifdef __CDS_CONTAINER_MICHAEL_LIST_BASE_H
+#ifdef __CDS_CONTAINER_DETAILS_MICHAEL_LIST_BASE_H
// if michael_list included
template <typename GC, typename T, typename Traits>
typedef cds::intrusive::MichaelList< gc, node_type, ordered_list_traits > ordered_list;
typedef cds::intrusive::SplitListSet< gc, ordered_list, type_traits > type;
};
-#endif // ifdef __CDS_CONTAINER_MICHAEL_LIST_BASE_H
+#endif // ifdef __CDS_CONTAINER_DETAILS_MICHAEL_LIST_BASE_H
-#ifdef __CDS_CONTAINER_LAZY_LIST_BASE_H
+#ifdef __CDS_CONTAINER_DETAILS_LAZY_LIST_BASE_H
// if lazy_list included
template <typename GC, typename T, typename Traits>
struct make_split_list_set< GC, T, lazy_list_tag, Traits >
typedef cds::intrusive::LazyList< gc, node_type, ordered_list_traits > ordered_list;
typedef cds::intrusive::SplitListSet< gc, ordered_list, type_traits > type;
};
-#endif // ifdef __CDS_CONTAINER_LAZY_LIST_BASE_H
+#endif // ifdef __CDS_CONTAINER_DETAILS_LAZY_LIST_BASE_H
} // namespace details
}} // namespace cds::container
- <tt>item.first</tt> is a const reference to item's key that cannot be changed.
- <tt>item.second</tt> is a reference to item's value that may be changed.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if inserting is successful.
The key_type should be constructible from value of type \p K.
bool insert_key( const K& key, Func func )
{
scoped_node_ptr pNode( cxx_leaf_node_allocator().New( key ));
- if ( base_class::insert( *pNode, [&func]( leaf_node& item ) { cds::unref(func)( item.m_Value ); } )) {
+ if ( base_class::insert( *pNode, [&func]( leaf_node& item ) { func( item.m_Value ); } )) {
pNode.release();
return true;
}
The functor may change any fields of the \p item.second that is \ref value_type.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
RCU \p synchronize method can be called. RCU should not be locked.
{
scoped_node_ptr pNode( cxx_leaf_node_allocator().New( key ));
std::pair<bool, bool> res = base_class::ensure( *pNode,
- [&func](bool bNew, leaf_node& item, leaf_node const& ){ cds::unref(func)( bNew, item.m_Value ); }
+ [&func](bool bNew, leaf_node& item, leaf_node const& ){ func( bNew, item.m_Value ); }
);
if ( res.first && res.second )
pNode.release();
template <typename K, typename Func>
bool erase( K const& key, Func f )
{
- return base_class::erase( key, [&f]( leaf_node& node) { cds::unref(f)( node.m_Value ); } );
+ return base_class::erase( key, [&f]( leaf_node& node) { f( node.m_Value ); } );
}
/// Deletes the item from the map using \p pred predicate for searching
bool erase_with( K const& key, Less pred, Func f )
{
return base_class::erase_with( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >(),
- [&f]( leaf_node& node) { cds::unref(f)( node.m_Value ); } );
+ [&f]( leaf_node& node) { f( node.m_Value ); } );
}
/// Extracts an item with minimal key from the map
\endcode
where \p item is the item found.
- You can pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by reference using \p std::ref
The functor may change \p item.second.
template <typename K, typename Func>
bool find( K const& key, Func f )
{
- return base_class::find( key, [&f](leaf_node& item, K const& ) { cds::unref(f)( item.m_Value );});
+ return base_class::find( key, [&f](leaf_node& item, K const& ) { f( item.m_Value );});
}
/// Finds the key \p val using \p pred predicate for searching
bool find_with( K const& key, Less pred, Func f )
{
return base_class::find_with( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >(),
- [&f](leaf_node& item, K const& ) { cds::unref(f)( item.m_Value );});
+ [&f](leaf_node& item, K const& ) { f( item.m_Value );});
}
/// Find the key \p key
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
The user-defined functor is called only if the inserting is success. It may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
RCU \p synchronize method can be called. RCU should not be locked.
*/
bool insert( Q const& val, Func f )
{
scoped_node_ptr sp( cxx_leaf_node_allocator().New( val ));
- if ( base_class::insert( *sp.get(), [&f]( leaf_node& val ) { cds::unref(f)( val.m_Value ); } )) {
+ if ( base_class::insert( *sp.get(), [&f]( leaf_node& val ) { f( val.m_Value ); } )) {
sp.release();
return true;
}
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
RCU \p synchronize method can be called. RCU should not be locked.
{
scoped_node_ptr sp( cxx_leaf_node_allocator().New( val ));
std::pair<bool, bool> bRes = base_class::ensure( *sp,
- [&func, &val](bool bNew, leaf_node& node, leaf_node&){ cds::unref(func)( bNew, node.m_Value, val ); });
+ [&func, &val](bool bNew, leaf_node& node, leaf_node&){ func( bNew, node.m_Value, val ); });
if ( bRes.first && bRes.second )
sp.release();
return bRes;
template <typename Q, typename Func>
bool erase( Q const& key, Func f )
{
- return base_class::erase( key, [&f]( leaf_node const& node) { cds::unref(f)( node.m_Value ); } );
+ return base_class::erase( key, [&f]( leaf_node const& node) { f( node.m_Value ); } );
}
/// Deletes the item from the set using \p pred predicate for searching
bool erase_with( Q const& key, Less pred, Func f )
{
return base_class::erase_with( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >(),
- [&f]( leaf_node const& node) { cds::unref(f)( node.m_Value ); } );
+ [&f]( leaf_node const& node) { f( node.m_Value ); } );
}
/// Extracts an item with minimal key from the set
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
template <typename Q, typename Func>
bool find( Q& val, Func f ) const
{
- return base_class::find( val, [&f]( leaf_node& node, Q& v ) { cds::unref(f)( node.m_Value, v ); });
+ return base_class::find( val, [&f]( leaf_node& node, Q& v ) { f( node.m_Value, v ); });
}
/// Finds the key \p val using \p pred predicate for searching
bool find_with( Q& val, Less pred, Func f ) const
{
return base_class::find_with( val, cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >(),
- [&f]( leaf_node& node, Q& v ) { cds::unref(f)( node.m_Value, v ); } );
+ [&f]( leaf_node& node, Q& v ) { f( node.m_Value, v ); } );
}
/// Find the key \p val
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
template <typename Q, typename Func>
bool find( Q const& val, Func f ) const
{
- return base_class::find( val, [&f]( leaf_node& node, Q const& v ) { cds::unref(f)( node.m_Value, v ); });
+ return base_class::find( val, [&f]( leaf_node& node, Q const& v ) { f( node.m_Value, v ); });
}
/// Finds the key \p val using \p pred predicate for searching
bool find_with( Q const& val, Less pred, Func f ) const
{
return base_class::find_with( val, cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >(),
- [&f]( leaf_node& node, Q const& v ) { cds::unref(f)( node.m_Value, v ); } );
+ [&f]( leaf_node& node, Q const& v ) { f( node.m_Value, v ); } );
}
/// Find the key \p val
- <tt>item.first</tt> is a const reference to item's key that cannot be changed.
- <tt>item.second</tt> is a reference to item's value that may be changed.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if inserting is successful.
The key_type should be constructible from value of type \p K.
bool insert_key( const K& key, Func func )
{
scoped_node_ptr pNode( cxx_leaf_node_allocator().New( key ));
- if ( base_class::insert( *pNode, [&func]( leaf_node& item ) { cds::unref(func)( item.m_Value ); } )) {
+ if ( base_class::insert( *pNode, [&func]( leaf_node& item ) { func( item.m_Value ); } )) {
pNode.release();
return true;
}
The functor may change any fields of the \p item.second that is \ref value_type.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref.
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
{
scoped_node_ptr pNode( cxx_leaf_node_allocator().New( key ));
std::pair<bool, bool> res = base_class::ensure( *pNode,
- [&func](bool bNew, leaf_node& item, leaf_node const& ){ cds::unref(func)( bNew, item.m_Value ); }
+ [&func](bool bNew, leaf_node& item, leaf_node const& ){ func( bNew, item.m_Value ); }
);
if ( res.first && res.second )
pNode.release();
template <typename K, typename Func>
bool erase( K const& key, Func f )
{
- return base_class::erase( key, [&f]( leaf_node& node) { cds::unref(f)( node.m_Value ); } );
+ return base_class::erase( key, [&f]( leaf_node& node) { f( node.m_Value ); } );
}
/// Deletes the item from the map using \p pred predicate for searching
bool erase_with( K const& key, Less pred, Func f )
{
return base_class::erase_with( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >(),
- [&f]( leaf_node& node) { cds::unref(f)( node.m_Value ); } );
+ [&f]( leaf_node& node) { f( node.m_Value ); } );
}
/// Extracts an item with minimal key from the map
\endcode
where \p item is the item found.
- You can pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by reference using std::ref.
The functor may change \p item.second.
template <typename K, typename Func>
bool find( K const& key, Func f )
{
- return base_class::find( key, [&f](leaf_node& item, K const& ) { cds::unref(f)( item.m_Value );});
+ return base_class::find( key, [&f](leaf_node& item, K const& ) { f( item.m_Value );});
}
/// Finds the key \p val using \p pred predicate for searching
bool find_with( K const& key, Less pred, Func f )
{
return base_class::find_with( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >(),
- [&f](leaf_node& item, K const& ) { cds::unref(f)( item.m_Value );});
+ [&f](leaf_node& item, K const& ) { f( item.m_Value );});
}
/// Find the key \p key
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
The user-defined functor is called only if the inserting is success. It may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
*/
template <typename Q, typename Func>
bool insert( Q const& val, Func f )
{
scoped_node_ptr sp( cxx_leaf_node_allocator().New( val ));
- if ( base_class::insert( *sp.get(), [&f]( leaf_node& val ) { cds::unref(f)( val.m_Value ); } )) {
+ if ( base_class::insert( *sp.get(), [&f]( leaf_node& val ) { f( val.m_Value ); } )) {
sp.release();
return true;
}
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref.
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
{
scoped_node_ptr sp( cxx_leaf_node_allocator().New( val ));
std::pair<bool, bool> bRes = base_class::ensure( *sp,
- [&func, &val](bool bNew, leaf_node& node, leaf_node&){ cds::unref(func)( bNew, node.m_Value, val ); });
+ [&func, &val](bool bNew, leaf_node& node, leaf_node&){ func( bNew, node.m_Value, val ); });
if ( bRes.first && bRes.second )
sp.release();
return bRes;
template <typename Q, typename Func>
bool erase( Q const& key, Func f )
{
- return base_class::erase( key, [&f]( leaf_node const& node) { cds::unref(f)( node.m_Value ); } );
+ return base_class::erase( key, [&f]( leaf_node const& node) { f( node.m_Value ); } );
}
/// Deletes the item from the set using \p pred predicate for searching
bool erase_with( Q const& key, Less pred, Func f )
{
return base_class::erase_with( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >(),
- [&f]( leaf_node const& node) { cds::unref(f)( node.m_Value ); } );
+ [&f]( leaf_node const& node) { f( node.m_Value ); } );
}
/// Extracts an item with minimal key from the set
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
template <typename Q, typename Func>
bool find( Q& val, Func f )
{
- return base_class::find( val, [&f]( leaf_node& node, Q& v ) { cds::unref(f)( node.m_Value, v ); });
+ return base_class::find( val, [&f]( leaf_node& node, Q& v ) { f( node.m_Value, v ); });
}
/// Finds the key \p val using \p pred predicate for searching
bool find_with( Q& val, Less pred, Func f )
{
return base_class::find_with( val, cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >(),
- [&f]( leaf_node& node, Q& v ) { cds::unref(f)( node.m_Value, v ); } );
+ [&f]( leaf_node& node, Q& v ) { f( node.m_Value, v ); } );
}
/// Find the key \p val
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
template <typename Q, typename Func>
bool find( Q const& val, Func f )
{
- return base_class::find( val, [&f]( leaf_node& node, Q const& v ) { cds::unref(f)( node.m_Value, v ); });
+ return base_class::find( val, [&f]( leaf_node& node, Q const& v ) { f( node.m_Value, v ); });
}
/// Finds the key \p val using \p pred predicate for searching
bool find_with( Q const& val, Less pred, Func f )
{
return base_class::find_with( val, cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >(),
- [&f]( leaf_node& node, Q const& v ) { cds::unref(f)( node.m_Value, v ); } );
+ [&f]( leaf_node& node, Q const& v ) { f( node.m_Value, v ); } );
}
/// Find the key \p val
#define __CDS_CONTAINER_IMPL_LAZY_KVLIST_H
#include <memory>
-#include <cds/ref.h>
+#include <functional> // ref
#include <cds/details/functor_wrapper.h>
#include <cds/container/details/guarded_ptr_cast.h>
to the list's item inserted. <tt>item.second</tt> is a reference to item's value that may be changed.
User-defined functor \p func should guarantee that during changing item's value no any other changes
could be made on this list's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if inserting is successful.
The key_type should be constructible from value of type \p K.
however, \p func must guarantee that during changing no any other modifications
could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref.
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ 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.
{
scoped_node_ptr pNode( alloc_node( key ));
- if ( base_class::insert_at( &refHead, *pNode, [&f](node_type& node){ cds::unref(f)( node.m_Data ); } )) {
+ if ( base_class::insert_at( &refHead, *pNode, [&f](node_type& node){ f( node.m_Data ); } )) {
pNode.release();
return true;
}
template <typename K, typename Compare, typename Func>
bool erase_at( head_type& refHead, K const& key, Compare cmp, Func f )
{
- return base_class::erase_at( &refHead, key, cmp, [&f](node_type const & node){cds::unref(f)( const_cast<value_type&>(node.m_Data)); });
+ return base_class::erase_at( &refHead, key, cmp, [&f](node_type const & node){f( const_cast<value_type&>(node.m_Data)); });
}
template <typename K, typename Compare>
scoped_node_ptr pNode( alloc_node( key ));
std::pair<bool, bool> ret = base_class::ensure_at( &refHead, *pNode,
- [&f]( bool bNew, node_type& node, node_type& ){ cds::unref(f)( bNew, node.m_Data ); });
+ [&f]( bool bNew, node_type& node, node_type& ){ f( bNew, node.m_Data ); });
if ( ret.first && ret.second )
pNode.release();
template <typename K, typename Compare, typename Func>
bool find_at( head_type& refHead, K& key, Compare cmp, Func f )
{
- return base_class::find_at( &refHead, key, cmp, [&f]( node_type& node, K& ){ cds::unref(f)( node.m_Data ); });
+ return base_class::find_at( &refHead, key, cmp, [&f]( node_type& node, K& ){ f( node.m_Data ); });
}
template <typename K, typename Compare>
The argument \p itemValue of user-defined functor \p func is the reference
to the list's item inserted. User-defined functor \p func should guarantee that during changing
item's value no any other changes could be made on this list's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if the inserting is success.
The type \p Q should contain the complete key of the node.
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the function is only guarantee
that \p item cannot be deleted during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The function does not serialize simultaneous access to the list \p item. If such access is
possible you must provide your own synchronization schema to exclude unsafe item modifications.
{
scoped_node_ptr pNode( alloc_node( key ));
- if ( base_class::insert_at( &refHead, *pNode, [&f](node_type& node){ cds::unref(f)( node_to_value(node) ); } )) {
+ if ( base_class::insert_at( &refHead, *pNode, [&f](node_type& node){ f( node_to_value(node) ); } )) {
pNode.release();
return true;
}
template <typename Q, typename Compare, typename Func>
bool erase_at( head_type& refHead, const Q& key, Compare cmp, Func f )
{
- return base_class::erase_at( &refHead, key, cmp, [&f](node_type const& node){ cds::unref(f)( node_to_value(node) ); } );
+ return base_class::erase_at( &refHead, key, cmp, [&f](node_type const& node){ f( node_to_value(node) ); } );
}
template <typename Q, typename Compare>
scoped_node_ptr pNode( alloc_node( key ));
std::pair<bool, bool> ret = base_class::ensure_at( &refHead, *pNode,
- [&f, &key](bool bNew, node_type& node, node_type&){cds::unref(f)( bNew, node_to_value(node), key ); });
+ [&f, &key](bool bNew, node_type& node, node_type&){f( bNew, node_to_value(node), key ); });
if ( ret.first && ret.second )
pNode.release();
template <typename Q, typename Compare, typename Func>
bool find_at( head_type& refHead, Q& val, Compare cmp, Func f )
{
- return base_class::find_at( &refHead, val, cmp, [&f](node_type& node, Q& val){ cds::unref(f)( node_to_value(node), val ); });
+ return base_class::find_at( &refHead, val, cmp, [&f](node_type& node, Q& val){ f( node_to_value(node), val ); });
}
template <typename Q, typename Compare>
#define __CDS_CONTAINER_IMPL_MICHAEL_KVLIST_H
#include <memory>
-#include <cds/ref.h>
+#include <functional> // ref
#include <cds/details/functor_wrapper.h>
#include <cds/container/details/guarded_ptr_cast.h>
to the list's item inserted. <tt>item.second</tt> is a reference to item's value that may be changed.
User-defined functor \p func should guarantee that during changing item's value no any other changes
could be made on this list's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if inserting is successful.
The key_type should be constructible from value of type \p K.
however, \p func must guarantee that during changing no any other modifications
could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ 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.
{
scoped_node_ptr pNode( alloc_node( key ));
- if ( base_class::insert_at( refHead, *pNode, [&f](node_type& node){ cds::unref(f)( node.m_Data ); })) {
+ if ( base_class::insert_at( refHead, *pNode, [&f](node_type& node){ f( node.m_Data ); })) {
pNode.release();
return true;
}
scoped_node_ptr pNode( alloc_node( key ));
std::pair<bool, bool> ret = base_class::ensure_at( refHead, *pNode,
- [&f]( bool bNew, node_type& node, node_type& ){ cds::unref(f)( bNew, node.m_Data ); });
+ [&f]( bool bNew, node_type& node, node_type& ){ f( bNew, node.m_Data ); });
if ( ret.first && ret.second )
pNode.release();
template <typename K, typename Compare, typename Func>
bool erase_at( head_type& refHead, K const& key, Compare cmp, Func f )
{
- return base_class::erase_at( refHead, key, cmp, [&f]( node_type const & node ){ cds::unref(f)( const_cast<value_type&>(node.m_Data)); });
+ return base_class::erase_at( refHead, key, cmp, [&f]( node_type const & node ){ f( const_cast<value_type&>(node.m_Data)); });
}
template <typename K, typename Compare>
bool extract_at( head_type& refHead, typename gc::Guard& dest, K const& key, Compare cmp )
template <typename K, typename Compare, typename Func>
bool find_at( head_type& refHead, K& key, Compare cmp, Func f )
{
- return base_class::find_at( refHead, key, cmp, [&f](node_type& node, K const&){ cds::unref(f)( node.m_Data ); });
+ return base_class::find_at( refHead, key, cmp, [&f](node_type& node, K const&){ f( node.m_Data ); });
}
template <typename K, typename Compare>
The argument \p itemValue of user-defined functor \p func is the reference
to the list's item inserted. User-defined functor \p func should guarantee that during changing
item's value no any other changes could be made on this list's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if the inserting is success.
The type \p Q should contain the complete key of the node.
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference by \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref
The functor may change non-key fields of \p item. Note that the function is only guarantee
that \p item cannot be deleted during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref
The functor may change non-key fields of \p item. Note that the function is only guarantee
that \p item cannot be deleted during functor is executing.
{
scoped_node_ptr pNode( alloc_node( key ));
- if ( base_class::insert_at( refHead, *pNode, [&f]( node_type& node ) { cds::unref(f)( node_to_value(node) ); } )) {
+ if ( base_class::insert_at( refHead, *pNode, [&f]( node_type& node ) { f( node_to_value(node) ); } )) {
pNode.release();
return true;
}
template <typename Q, typename Compare, typename Func>
bool erase_at( head_type& refHead, Q const& key, Compare cmp, Func f )
{
- return base_class::erase_at( refHead, key, cmp, [&f](node_type const& node){ cds::unref(f)( node_to_value(node) ); } );
+ return base_class::erase_at( refHead, key, cmp, [&f](node_type const& node){ f( node_to_value(node) ); } );
}
template <typename Q, typename Compare>
scoped_node_ptr pNode( alloc_node( key ));
std::pair<bool, bool> ret = base_class::ensure_at( refHead, *pNode,
- [&f, &key](bool bNew, node_type& node, node_type&){ cds::unref(f)( bNew, node_to_value(node), key ); });
+ [&f, &key](bool bNew, node_type& node, node_type&){ f( bNew, node_to_value(node), key ); });
if ( ret.first && ret.second )
pNode.release();
template <typename Q, typename Compare, typename Func>
bool find_at( head_type& refHead, Q& val, Compare cmp, Func f )
{
- return base_class::find_at( refHead, val, cmp, [&f](node_type& node, Q& v){ cds::unref(f)( node_to_value(node), v ); });
+ return base_class::find_at( refHead, val, cmp, [&f](node_type& node, Q& v){ f( node_to_value(node), v ); });
}
template <typename Q, typename Compare>
- <tt>item.first</tt> is a const reference to item's key that cannot be changed.
- <tt>item.second</tt> is a reference to item's value that may be changed.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if inserting is successful.
The key_type should be constructible from value of type \p K.
bool insert_key( const K& key, Func func )
{
scoped_node_ptr pNode( node_allocator().New( random_level(), key ));
- if ( base_class::insert( *pNode, [&func]( node_type& item ) { cds::unref(func)( item.m_Value ); } )) {
+ if ( base_class::insert( *pNode, [&func]( node_type& item ) { func( item.m_Value ); } )) {
pNode.release();
return true;
}
The functor may change any fields of the \p item.second that is \ref value_type.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
{
scoped_node_ptr pNode( node_allocator().New( random_level(), key ));
std::pair<bool, bool> res = base_class::ensure( *pNode,
- [&func](bool bNew, node_type& item, node_type const& ){ cds::unref(func)( bNew, item.m_Value ); }
+ [&func](bool bNew, node_type& item, node_type const& ){ func( bNew, item.m_Value ); }
);
if ( res.first && res.second )
pNode.release();
template <typename K, typename Func>
bool erase( K const& key, Func f )
{
- return base_class::erase( key, [&f]( node_type& node) { cds::unref(f)( node.m_Value ); } );
+ return base_class::erase( key, [&f]( node_type& node) { f( node.m_Value ); } );
}
/// Deletes the item from the map using \p pred predicate for searching
{
return base_class::erase_with( key,
cds::details::predicate_wrapper< node_type, Less, typename maker::key_accessor >(),
- [&f]( node_type& node) { cds::unref(f)( node.m_Value ); } );
+ [&f]( node_type& node) { f( node.m_Value ); } );
}
/// Extracts the item from the map with specified \p key
\endcode
where \p item is the item found.
- You can pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by reference using \p std::ref
The functor may change \p item.second.
template <typename K, typename Func>
bool find( K const& key, Func f )
{
- return base_class::find( key, [&f](node_type& item, K const& ) { cds::unref(f)( item.m_Value );});
+ return base_class::find( key, [&f](node_type& item, K const& ) { f( item.m_Value );});
}
/// Finds the key \p val using \p pred predicate for searching
{
return base_class::find_with( key,
cds::details::predicate_wrapper< node_type, Less, typename maker::key_accessor >(),
- [&f](node_type& item, K const& ) { cds::unref(f)( item.m_Value );});
+ [&f](node_type& item, K const& ) { f( item.m_Value );});
}
/// Find the key \p key
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
The user-defined functor is called only if the inserting is success. It may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
*/
template <typename Q, typename Func>
bool insert( Q const& val, Func f )
{
scoped_node_ptr sp( node_allocator().New( random_level(), val ));
- if ( base_class::insert( *sp.get(), [&f]( node_type& val ) { cds::unref(f)( val.m_Value ); } )) {
+ if ( base_class::insert( *sp.get(), [&f]( node_type& val ) { f( val.m_Value ); } )) {
sp.release();
return true;
}
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
{
scoped_node_ptr sp( node_allocator().New( random_level(), val ));
std::pair<bool, bool> bRes = base_class::ensure( *sp,
- [&func, &val](bool bNew, node_type& node, node_type&){ cds::unref(func)( bNew, node.m_Value, val ); });
+ [&func, &val](bool bNew, node_type& node, node_type&){ func( bNew, node.m_Value, val ); });
if ( bRes.first && bRes.second )
sp.release();
return bRes;
template <typename Q, typename Func>
bool erase( Q const& key, Func f )
{
- return base_class::erase( key, [&f]( node_type const& node) { cds::unref(f)( node.m_Value ); } );
+ return base_class::erase( key, [&f]( node_type const& node) { f( node.m_Value ); } );
}
/// Deletes the item from the set using \p pred predicate for searching
bool erase_with( Q const& key, Less pred, Func f )
{
return base_class::erase_with( key, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >(),
- [&f]( node_type const& node) { cds::unref(f)( node.m_Value ); } );
+ [&f]( node_type const& node) { f( node.m_Value ); } );
}
/// Extracts the item from the set with specified \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
template <typename Q, typename Func>
bool find( Q& val, Func f )
{
- return base_class::find( val, [&f]( node_type& node, Q& v ) { cds::unref(f)( node.m_Value, v ); });
+ return base_class::find( val, [&f]( node_type& node, Q& v ) { f( node.m_Value, v ); });
}
/// Finds the key \p val using \p pred predicate for searching
bool find_with( Q& val, Less pred, Func f )
{
return base_class::find_with( val, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >(),
- [&f]( node_type& node, Q& v ) { cds::unref(f)( node.m_Value, v ); } );
+ [&f]( node_type& node, Q& v ) { f( node.m_Value, v ); } );
}
/// Find the key \p val
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
template <typename Q, typename Func>
bool find( Q const& val, Func f )
{
- return base_class::find( val, [&f]( node_type& node, Q const& v ) { cds::unref(f)( node.m_Value, v ); });
+ return base_class::find( val, [&f]( node_type& node, Q const& v ) { f( node.m_Value, v ); });
}
/// Finds the key \p val using \p pred predicate for searching
bool find_with( Q const& val, Less cmp, Func f )
{
return base_class::find_with( val, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >(),
- [&f]( node_type& node, Q const& v ) { cds::unref(f)( node.m_Value, v ); } );
+ [&f]( node_type& node, Q const& v ) { f( node.m_Value, v ); } );
}
/// Find the key \p val
to the list's item inserted. <tt>item.second</tt> is a reference to item's value that may be changed.
User-defined functor \p func should guarantee that during changing item's value no any other changes
could be made on this list's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if the inserting is successful.
The key_type should be constructible from value of type \p K.
scoped_node_ptr pNode( alloc_node( key ));
if ( base_class::insert_at( &refHead, *pNode )) {
- cds::unref(f)( pNode->m_Data );
+ f( pNode->m_Data );
return pNode.release();
}
template <typename K, typenam Compare, typename Func>
bool find_at( head_type& refHead, K& key, Compare cmp, Func f )
{
- return base_class::find_at( &refHead, key, cmp, [&f]( node_type& node, K const& ){ cds::unref(f)( node.m_Data ); });
+ return base_class::find_at( &refHead, key, cmp, [&f]( node_type& node, K const& ){ f( node.m_Data ); });
}
*/
//@endcond
#define __CDS_CONTAINER_LAZY_KVLIST_RCU_H
#include <memory>
+#include <functional> // ref
#include <cds/container/details/lazy_list_base.h>
#include <cds/intrusive/lazy_list_rcu.h>
#include <cds/container/details/make_lazy_kvlist.h>
-#include <cds/ref.h>
#include <cds/details/functor_wrapper.h>
namespace cds { namespace container {
to the list's item inserted. <tt>item.second</tt> is a reference to item's value that may be changed.
User-defined functor \p func should guarantee that during changing item's value no any other changes
could be made on this list's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if inserting is successful.
The key_type should be constructible from value of type \p K.
however, \p func must guarantee that during changing no any other modifications
could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
The function makes RCU lock internally.
\endcode
where \p item is the item found.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ 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.
{
scoped_node_ptr pNode( alloc_node( key ));
- if ( base_class::insert_at( &refHead, *pNode, [&f](node_type& node){ cds::unref(f)( node.m_Data ); } )) {
+ if ( base_class::insert_at( &refHead, *pNode, [&f](node_type& node){ f( node.m_Data ); } )) {
pNode.release();
return true;
}
template <typename K, typename Compare, typename Func>
bool erase_at( head_type& refHead, K const & key, Compare cmp, Func f )
{
- return base_class::erase_at( &refHead, key, cmp, [&f](node_type const & node){cds::unref(f)( const_cast<value_type&>(node.m_Data)); });
+ return base_class::erase_at( &refHead, key, cmp, [&f](node_type const & node){f( const_cast<value_type&>(node.m_Data)); });
}
template <typename K, typename Func>
scoped_node_ptr pNode( alloc_node( key ));
std::pair<bool, bool> ret = base_class::ensure_at( &refHead, *pNode,
- [&f]( bool bNew, node_type& node, node_type& ){ cds::unref(f)( bNew, node.m_Data ); });
+ [&f]( bool bNew, node_type& node, node_type& ){ f( bNew, node.m_Data ); });
if ( ret.first && ret.second )
pNode.release();
template <typename K, typename Compare, typename Func>
bool find_at( head_type& refHead, K& key, Compare cmp, Func f ) const
{
- return base_class::find_at( &refHead, key, cmp, [&f]( node_type& node, K& ){ cds::unref(f)( node.m_Data ); });
+ return base_class::find_at( &refHead, key, cmp, [&f]( node_type& node, K& ){ f( node.m_Data ); });
}
template <typename K, typename Compare>
The argument \p itemValue of user-defined functor \p func is the reference
to the list's item inserted. User-defined functor \p func should guarantee that during changing
item's value no any other changes could be made on this list's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if the inserting is success.
The type \p Q should contain the complete key of the node.
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
The function applies RCU lock internally.
void operator()( value_type& item, Q& val );
};
\endcode
- where \p item is the item found, \p val is the <tt>find</tt> function argument.
+ where \p item is the item found, \p val is the \p find() function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the function is only guarantee
that \p item cannot be deleted during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The function does not serialize simultaneous access to the list \p item. If such access is
possible you must provide your own synchronization schema to exclude unsafe item modifications.
{
scoped_node_ptr pNode( alloc_node( key ));
- if ( base_class::insert_at( &refHead, *pNode, [&f](node_type& node){ cds::unref(f)( node_to_value(node) ); } )) {
+ if ( base_class::insert_at( &refHead, *pNode, [&f](node_type& node){ f( node_to_value(node) ); } )) {
pNode.release();
return true;
}
template <typename Q, typename Compare, typename Func>
bool erase_at( head_type& refHead, Q const& key, Compare cmp, Func f )
{
- return base_class::erase_at( &refHead, key, cmp, [&f](node_type const& node){ cds::unref(f)( node_to_value(node) ); } );
+ return base_class::erase_at( &refHead, key, cmp, [&f](node_type const& node){ f( node_to_value(node) ); } );
}
template <typename Q, typename Compare>
scoped_node_ptr pNode( alloc_node( key ));
std::pair<bool, bool> ret = base_class::ensure_at( &refHead, *pNode,
- [&f, &key](bool bNew, node_type& node, node_type&){cds::unref(f)( bNew, node_to_value(node), key ); });
+ [&f, &key](bool bNew, node_type& node, node_type&){f( bNew, node_to_value(node), key ); });
if ( ret.first && ret.second )
pNode.release();
template <typename Q, typename Compare, typename Func>
bool find_at( head_type& refHead, Q& val, Compare cmp, Func f ) const
{
- return base_class::find_at( &refHead, val, cmp, [&f](node_type& node, Q& val){ cds::unref(f)( node_to_value(node), val ); });
+ return base_class::find_at( &refHead, val, cmp, [&f](node_type& node, Q& val){ f( node_to_value(node), val ); });
}
template <typename Q, typename Compare>
to the list's item inserted. <tt>item.second</tt> is a reference to item's value that may be changed.
User-defined functor \p func should guarantee that during changing item's value no any other changes
could be made on this list's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if the inserting is successful.
The key_type should be constructible from value of type \p K.
scoped_node_ptr pNode( alloc_node( key ));
if ( base_class::insert_at( refHead, *pNode )) {
- cds::unref(f)( pNode->m_Data );
+ f( pNode->m_Data );
return pNode.release();
}
return nullptr;
template <typename K, typename Compare typename Func>
bool find_at( head_type& refHead, K& key, Compare cmp, Func f )
{
- return base_class::find_at( refHead, key, cmp, [&f]( node_type& node, K const& ){ cds::unref(f)( node.m_Data ); });
+ return base_class::find_at( refHead, key, cmp, [&f]( node_type& node, K const& ){ f( node.m_Data ); });
}
*/
//@endcond
#define __CDS_CONTAINER_MICHAEL_KVLIST_RCU_H
#include <memory>
+#include <functional> // ref
#include <cds/container/details/michael_list_base.h>
#include <cds/intrusive/michael_list_rcu.h>
#include <cds/container/details/make_michael_kvlist.h>
-#include <cds/ref.h>
#include <cds/details/functor_wrapper.h>
namespace cds { namespace container {
to the list's item inserted. <tt>item.second</tt> is a reference to item's value that may be changed.
User-defined functor \p func should guarantee that during changing item's value no any other changes
could be made on this list's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if inserting is successful.
The key_type should be constructible from value of type \p K.
however, \p func must guarantee that during changing no any other modifications
could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
The function makes RCU lock internally.
\endcode
where \p item is the item found.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ 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.
{
scoped_node_ptr pNode( alloc_node( key ));
- if ( base_class::insert_at( refHead, *pNode, [&f](node_type& node){ cds::unref(f)( node.m_Data ); })) {
+ if ( base_class::insert_at( refHead, *pNode, [&f](node_type& node){ f( node.m_Data ); })) {
pNode.release();
return true;
}
scoped_node_ptr pNode( alloc_node( key ));
std::pair<bool, bool> ret = base_class::ensure_at( refHead, *pNode,
- [&f]( bool bNew, node_type& node, node_type& ){ cds::unref(f)( bNew, node.m_Data ); });
+ [&f]( bool bNew, node_type& node, node_type& ){ f( bNew, node.m_Data ); });
if ( ret.first && ret.second )
pNode.release();
template <typename K, typename Compare, typename Func>
bool erase_at( head_type& refHead, K const& key, Compare cmp, Func f )
{
- return base_class::erase_at( refHead, key, cmp, [&f]( node_type const & node ){ cds::unref(f)( const_cast<value_type&>(node.m_Data)); });
+ return base_class::erase_at( refHead, key, cmp, [&f]( node_type const & node ){ f( const_cast<value_type&>(node.m_Data)); });
}
template <typename K, typename Compare>
template <typename K, typename Compare, typename Func>
bool find_at( head_type& refHead, K& key, Compare cmp, Func f ) const
{
- return base_class::find_at( refHead, key, cmp, [&f](node_type& node, K const&){ cds::unref(f)( node.m_Data ); });
+ return base_class::find_at( refHead, key, cmp, [&f](node_type& node, K const&){ f( node.m_Data ); });
}
template <typename K, typename Compare>
The argument \p itemValue of user-defined functor \p func is the reference
to the list's item inserted. User-defined functor \p func should guarantee that during changing
item's value no any other changes could be made on this list's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if the inserting is success.
The type \p Q should contain the complete key of the node.
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
The function makes RCU lock internally.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the function is only guarantee
that \p item cannot be deleted during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the function is only guarantee
that \p item cannot be deleted during functor is executing.
{
scoped_node_ptr pNode( alloc_node( key ));
- if ( base_class::insert_at( refHead, *pNode, [&f]( node_type& node ) { cds::unref(f)( node_to_value(node) ); } )) {
+ if ( base_class::insert_at( refHead, *pNode, [&f]( node_type& node ) { f( node_to_value(node) ); } )) {
pNode.release();
return true;
}
template <typename Q, typename Compare, typename Func>
bool erase_at( head_type& refHead, Q const& key, Compare cmp, Func f )
{
- return base_class::erase_at( refHead, key, cmp, [&f](node_type const& node){ cds::unref(f)( node_to_value(node) ); } );
+ return base_class::erase_at( refHead, key, cmp, [&f](node_type const& node){ f( node_to_value(node) ); } );
}
template <typename Q, typename Func>
scoped_node_ptr pNode( alloc_node( key ));
std::pair<bool, bool> ret = base_class::ensure_at( refHead, *pNode,
- [&f, &key](bool bNew, node_type& node, node_type&){ cds::unref(f)( bNew, node_to_value(node), key ); });
+ [&f, &key](bool bNew, node_type& node, node_type&){ f( bNew, node_to_value(node), key ); });
if ( ret.first && ret.second )
pNode.release();
template <typename Q, typename Compare, typename Func>
bool find_at( head_type& refHead, Q& val, Compare cmp, Func f ) const
{
- return base_class::find_at( refHead, val, cmp, [&f](node_type& node, Q& v){ cds::unref(f)( node_to_value(node), v ); });
+ return base_class::find_at( refHead, val, cmp, [&f](node_type& node, Q& v){ f( node_to_value(node), v ); });
}
template <typename Q, typename Compare>
User-defined functor \p func should guarantee that during changing item's value no any other changes
could be made on this map's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if inserting is successful.
The key_type should be constructible from value of type \p K.
however, \p func must guarantee that during changing no any other modifications
could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change \p item.second. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
to the map's item inserted. <tt>item.second</tt> is a reference to item's value that may be changed.
User-defined functor \p func should guarantee that during changing item's value no any other changes
could be made on this map's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if the inserting is successful.
The key_type should be constructible from value of type \p K.
User-defined functor \p func should guarantee that during changing item's value no any other changes
could be made on this map's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if inserting is successful.
The key_type should be constructible from value of type \p K.
however, \p func must guarantee that during changing no any other modifications
could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
The function applies RCU lock internally.
\endcode
where \p item is the item found.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change \p item.second. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
The user-defined functor is called only if the inserting is success. It may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
*/
template <typename Q, typename Func>
bool insert( Q const& val, Func f )
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
The user-defined functor is called only if the inserting is success. It may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
The function applies RCU lock internally.
*/
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
The function applies RCU lock internally.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
#define __CDS_CONTAINER_MOIR_QUEUE_H
#include <memory>
+#include <functional> // ref
#include <cds/intrusive/moir_queue.h>
#include <cds/intrusive/details/queue_stat.h>
#include <cds/container/details/base.h>
-#include <cds/ref.h>
#include <cds/details/trivial_assign.h>
namespace cds { namespace container {
bool enqueue( const Type& data, Func f )
{
scoped_node_ptr p( alloc_node());
- unref(f)( node_traits::to_value_ptr( *p )->m_value, data );
+ f( node_traits::to_value_ptr( *p )->m_value, data );
if ( base_class::enqueue( *p )) {
p.release();
return true;
{
typename base_class::dequeue_result res;
if ( base_class::do_dequeue( res )) {
- unref(f)( dest, node_traits::to_value_ptr( *res.pNext )->m_value );
+ f( dest, node_traits::to_value_ptr( *res.pNext )->m_value );
base_class::dispose_result( res );
{
value_type * pVal = base_class::pop();
if ( pVal ) {
- cds::unref(f)( dest, *pVal );
+ f( dest, *pVal );
cxx_allocator().Delete( pVal );
return true;
}
template <typename Func>
void clear_with( Func f )
{
- base_class::clear_with( [&f]( value_type& val ) { cds::unref(f)(val); value_deleter()( &val ); } );
+ base_class::clear_with( [&f]( value_type& val ) { f(val); value_deleter()( &val ); } );
}
/// Checks is the priority queue is empty
#define __CDS_CONTAINER_MSQUEUE_H
#include <memory>
+#include <functional> // ref
#include <cds/intrusive/msqueue.h>
#include <cds/container/details/base.h>
-#include <cds/ref.h>
#include <cds/details/trivial_assign.h>
namespace cds { namespace container {
bool enqueue( Type const& data, Func f )
{
scoped_node_ptr p( alloc_node() );
- unref(f)( p->m_value, data );
+ f( p->m_value, data );
if ( base_class::enqueue( *p )) {
p.release();
return true;
{
typename base_class::dequeue_result res;
if ( base_class::do_dequeue( res )) {
- unref(f)( dest, node_traits::to_value_ptr( *res.pNext )->m_value );
+ f( dest, node_traits::to_value_ptr( *res.pNext )->m_value );
base_class::dispose_result( res );
#define __CDS_CONTAINER_OPTIMISTIC_QUEUE_H
#include <memory>
+#include <functional> // ref
#include <cds/intrusive/optimistic_queue.h>
#include <cds/container/details/base.h>
-#include <cds/ref.h>
#include <cds/details/trivial_assign.h>
namespace cds { namespace container {
bool enqueue( const Type& data, Func f )
{
scoped_node_ptr p( alloc_node() );
- unref(f)( p->m_value, data );
+ f( p->m_value, data );
if ( base_class::enqueue( *p )) {
p.release();
return true;
{
typename base_class::dequeue_result res;
if ( base_class::do_dequeue( res )) {
- unref(f)( dest, node_traits::to_value_ptr( *res.pNext )->m_value );
+ f( dest, node_traits::to_value_ptr( *res.pNext )->m_value );
base_class::dispose_result( res );
#define __CDS_CONTAINER_RWQUEUE_H
#include <memory>
+#include <functional> // ref
#include <cds/opt/options.h>
#include <cds/lock/spinlock.h>
#include <cds/intrusive/details/queue_stat.h>
#include <cds/details/allocator.h>
#include <cds/details/trivial_assign.h>
-#include <cds/ref.h>
namespace cds { namespace container {
bool enqueue( Type const& data, Func f )
{
scoped_node_ptr p( alloc_node());
- unref(f)( p->m_value, data );
+ f( p->m_value, data );
if ( enqueue_node( p.get() )) {
p.release();
return true;
node_type * pNewHead = pNode->m_pNext;
if ( pNewHead == nullptr )
return false;
- unref(f)( dest, pNewHead->m_value );
+ f( dest, pNewHead->m_value );
m_pHead = pNewHead;
} // unlock here
--m_ItemCounter;
#define __CDS_CONTAINER_SEGMENTED_QUEUE_H
#include <memory>
+#include <functional> // ref
#include <cds/intrusive/segmented_queue.h>
#include <cds/details/trivial_assign.h>
-#include <cds/ref.h>
namespace cds { namespace container {
bool enqueue( Q const& data, Func f )
{
scoped_node_ptr p( alloc_node() );
- unref(f)( *p, data );
+ f( *p, data );
if ( base_class::enqueue( *p )) {
p.release();
return true;
{
value_type * p = base_class::dequeue();
if ( p ) {
- unref(f)( dest, *p );
+ f( dest, *p );
gc::template retire< typename maker::node_disposer >( p );
return true;
}
to the map's item inserted. <tt>item.second</tt> is a reference to item's value that may be changed.
User-defined functor \p func should guarantee that during changing item's value no any other changes
could be made on this map's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if the inserting is successful.
The key_type should be constructible from value of type \p K.
{
iterator it = insert( key );
if ( it != end() )
- cds::unref( func )( (*it) );
+ func( (*it) );
return it;
}
- <tt>item.first</tt> is a const reference to item's key that cannot be changed.
- <tt>item.second</tt> is a reference to item's value that may be changed.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if inserting is successful.
The key_type should be constructible from value of type \p K.
bool insert_key( const K& key, Func func )
{
scoped_node_ptr pNode( node_allocator().New( random_level(), key ));
- if ( base_class::insert( *pNode, [&func]( node_type& item ) { cds::unref(func)( item.m_Value ); } )) {
+ if ( base_class::insert( *pNode, [&func]( node_type& item ) { func( item.m_Value ); } )) {
pNode.release();
return true;
}
The functor may change any fields of the \p item.second that is \ref value_type.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
RCU \p synchronize method can be called. RCU should not be locked.
{
scoped_node_ptr pNode( node_allocator().New( random_level(), key ));
std::pair<bool, bool> res = base_class::ensure( *pNode,
- [&func](bool bNew, node_type& item, node_type const& ){ cds::unref(func)( bNew, item.m_Value ); }
+ [&func](bool bNew, node_type& item, node_type const& ){ func( bNew, item.m_Value ); }
);
if ( res.first && res.second )
pNode.release();
template <typename K, typename Func>
bool erase( K const& key, Func f )
{
- return base_class::erase( key, [&f]( node_type& node) { cds::unref(f)( node.m_Value ); } );
+ return base_class::erase( key, [&f]( node_type& node) { f( node.m_Value ); } );
}
/// Deletes the item from the map using \p pred predicate for searching
bool erase_with( K const& key, Less pred, Func f )
{
return base_class::erase_with( key, cds::details::predicate_wrapper< node_type, Less, typename maker::key_accessor >(),
- [&f]( node_type& node) { cds::unref(f)( node.m_Value ); } );
+ [&f]( node_type& node) { f( node.m_Value ); } );
}
/// Extracts the item from the map with specified \p key
\endcode
where \p item is the item found.
- You can pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by reference using \p std::ref.
The functor may change \p item.second.
template <typename K, typename Func>
bool find( K const& key, Func f )
{
- return base_class::find( key, [&f](node_type& item, K const& ) { cds::unref(f)( item.m_Value );});
+ return base_class::find( key, [&f](node_type& item, K const& ) { f( item.m_Value );});
}
/// Finds the key \p val using \p pred predicate for searching
bool find_with( K const& key, Less pred, Func f )
{
return base_class::find_with( key, cds::details::predicate_wrapper< node_type, Less, typename maker::key_accessor >(),
- [&f](node_type& item, K const& ) { cds::unref(f)( item.m_Value );});
+ [&f](node_type& item, K const& ) { f( item.m_Value );});
}
/// Find the key \p key
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
The user-defined functor is called only if the inserting is success. It may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
RCU \p synchronize method can be called. RCU should not be locked.
*/
bool insert( Q const& val, Func f )
{
scoped_node_ptr sp( node_allocator().New( random_level(), val ));
- if ( base_class::insert( *sp.get(), [&f]( node_type& val ) { cds::unref(f)( val.m_Value ); } )) {
+ if ( base_class::insert( *sp.get(), [&f]( node_type& val ) { f( val.m_Value ); } )) {
sp.release();
return true;
}
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
RCU \p synchronize method can be called. RCU should not be locked.
{
scoped_node_ptr sp( node_allocator().New( random_level(), val ));
std::pair<bool, bool> bRes = base_class::ensure( *sp,
- [&func, &val](bool bNew, node_type& node, node_type&){ cds::unref(func)( bNew, node.m_Value, val ); });
+ [&func, &val](bool bNew, node_type& node, node_type&){ func( bNew, node.m_Value, val ); });
if ( bRes.first && bRes.second )
sp.release();
return bRes;
template <typename Q, typename Func>
bool erase( Q const& key, Func f )
{
- return base_class::erase( key, [&f]( node_type const& node) { cds::unref(f)( node.m_Value ); } );
+ return base_class::erase( key, [&f]( node_type const& node) { f( node.m_Value ); } );
}
/// Deletes the item from the set using \p pred predicate for searching
bool erase_with( Q const& key, Less pred, Func f )
{
return base_class::erase_with( key, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >(),
- [&f]( node_type const& node) { cds::unref(f)( node.m_Value ); } );
+ [&f]( node_type const& node) { f( node.m_Value ); } );
}
/// Extracts the item from the set with specified \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
template <typename Q, typename Func>
bool find( Q& val, Func f )
{
- return base_class::find( val, [&f]( node_type& node, Q& v ) { cds::unref(f)( node.m_Value, v ); });
+ return base_class::find( val, [&f]( node_type& node, Q& v ) { f( node.m_Value, v ); });
}
/// Finds the key \p val using \p pred predicate for searching
bool find_with( Q& val, Less pred, Func f )
{
return base_class::find_with( val, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >(),
- [&f]( node_type& node, Q& v ) { cds::unref(f)( node.m_Value, v ); } );
+ [&f]( node_type& node, Q& v ) { f( node.m_Value, v ); } );
}
/// Find the key \p val
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
template <typename Q, typename Func>
bool find( Q const& val, Func f )
{
- return base_class::find( val, [&f]( node_type& node, Q const& v ) { cds::unref(f)( node.m_Value, v ); });
+ return base_class::find( val, [&f]( node_type& node, Q const& v ) { f( node.m_Value, v ); });
}
/// Finds the key \p val using \p pred predicate for searching
bool find_with( Q const& val, Less pred, Func f )
{
return base_class::find_with( val, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >(),
- [&f]( node_type& node, Q const& v ) { cds::unref(f)( node.m_Value, v ); } );
+ [&f]( node_type& node, Q const& v ) { f( node.m_Value, v ); } );
}
/// Find the key \p val
User-defined functor \p func should guarantee that during changing item's value no any other changes
could be made on this \p item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if inserting is successful.
The key_type should be constructible from value of type \p K.
however, \p func must guarantee that during changing no any other modifications
could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
//TODO: pass arguments by reference (make_pair makes copy)
return base_class::ensure( std::make_pair( key, mapped_type() ),
[&func](bool bNew, value_type& item, value_type const& /*val*/) {
- cds::unref(func)( bNew, item );
+ func( bNew, item );
} );
}
\endcode
where \p item is the item found.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change \p item.second. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
template <typename K, typename Func>
bool find( K const& key, Func f )
{
- return base_class::find( key, [&f](value_type& pair, K const&){ cds::unref(f)( pair ); } );
+ return base_class::find( key, [&f](value_type& pair, K const&){ f( pair ); } );
}
/// Finds the key \p val using \p pred predicate for searching
{
return base_class::find_with( key,
cds::details::predicate_wrapper<value_type, Less, key_accessor>(),
- [&f](value_type& pair, K const&){ cds::unref(f)( pair ); } );
+ [&f](value_type& pair, K const&){ f( pair ); } );
}
/// Finds the key \p key
to the map's item inserted. <tt>item.second</tt> is a reference to item's value that may be changed.
User-defined functor \p func should guarantee that during changing item's value no any other changes
could be made on this map's item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if the inserting is successful.
The key_type should be constructible from value of type \p K.
{
iterator it = insert( key );
if ( it != end() )
- cds::unref( func )( (*it) );
+ func( (*it) );
return it;
}
User-defined functor \p func should guarantee that during changing item's value no any other changes
could be made on this \p item by concurrent threads.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if inserting is successful.
The key_type should be constructible from value of type \p K.
however, \p func must guarantee that during changing no any other modifications
could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
The function applies RCU lock internally.
//TODO: pass arguments by reference (make_pair makes copy)
return base_class::ensure( std::make_pair( key, mapped_type() ),
[&func](bool bNew, value_type& item, value_type const& /*val*/) {
- cds::unref(func)( bNew, item );
+ func( bNew, item );
} );
}
\endcode
where \p item is the item found.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change \p item.second. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
template <typename K, typename Func>
bool find( K const& key, Func f )
{
- return base_class::find( key, [&f](value_type& pair, K const&){ cds::unref(f)( pair ); } );
+ return base_class::find( key, [&f](value_type& pair, K const&){ f( pair ); } );
}
/// Finds the key \p key using \p pred predicate for searching
{
return base_class::find_with( key,
cds::details::predicate_wrapper<value_type, Less, key_accessor>(),
- [&f](value_type& pair, K const&){ cds::unref(f)( pair ); } );
+ [&f](value_type& pair, K const&){ f( pair ); } );
}
/// Finds the key \p key
template <typename Q, typename Func>
bool find_( Q& val, Func f )
{
- return base_class::find( val, [&f]( node_type& item, Q& val ) { cds::unref(f)(item.m_Value, val) ; } );
+ return base_class::find( val, [&f]( node_type& item, Q& val ) { f(item.m_Value, val) ; } );
}
template <typename Q, typename Less, typename Func>
bool find_with_( Q& val, Less pred, Func f )
{
return base_class::find_with( val, typename maker::template predicate_wrapper<Less>::type(),
- [&f]( node_type& item, Q& val ) { cds::unref(f)(item.m_Value, val) ; } );
+ [&f]( node_type& item, Q& val ) { f(item.m_Value, val) ; } );
}
template <typename... Args>
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
The user-defined functor is called only if the inserting is success. It may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
*/
template <typename Q, typename Func>
bool insert( Q const& val, Func f )
{
scoped_node_ptr pNode( alloc_node( val ));
- if ( base_class::insert( *pNode, [&f](node_type& node) { cds::unref(f)( node.m_Value ) ; } )) {
+ if ( base_class::insert( *pNode, [&f](node_type& node) { f( node.m_Value ) ; } )) {
pNode.release();
return true;
}
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
std::pair<bool, bool> bRet = base_class::ensure( *pNode,
[&func, &val]( bool bNew, node_type& item, node_type const& /*val*/ ) {
- cds::unref(func)( bNew, item.m_Value, val );
+ func( bNew, item.m_Value, val );
} );
if ( bRet.first && bRet.second )
template <typename Q, typename Func>
bool erase( Q const& key, Func f )
{
- return base_class::erase( key, [&f](node_type& node) { cds::unref(f)( node.m_Value ); } );
+ return base_class::erase( key, [&f](node_type& node) { f( node.m_Value ); } );
}
/// Deletes the item from the set using \p pred predicate for searching
bool erase_with( Q const& key, Less pred, Func f )
{
return base_class::erase_with( key, typename maker::template predicate_wrapper<Less>::type(),
- [&f](node_type& node) { cds::unref(f)( node.m_Value ); } );
+ [&f](node_type& node) { f( node.m_Value ); } );
}
/// Extracts the item with specified \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
template <typename Q, typename Func>
bool find_( Q& val, Func f )
{
- return base_class::find( val, [&f]( node_type& item, Q& val ) { cds::unref(f)(item.m_Value, val) ; } );
+ return base_class::find( val, [&f]( node_type& item, Q& val ) { f(item.m_Value, val) ; } );
}
template <typename Q, typename Less, typename Func>
bool find_with_( Q& val, Less pred, Func f )
{
return base_class::find_with( val, typename maker::template predicate_wrapper<Less>::type(),
- [&f]( node_type& item, Q& val ) { cds::unref(f)(item.m_Value, val) ; } );
+ [&f]( node_type& item, Q& val ) { f(item.m_Value, val) ; } );
}
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
The user-defined functor is called only if the inserting is success. It may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
The function applies RCU lock internally.
*/
{
scoped_node_ptr pNode( alloc_node( val ));
- if ( base_class::insert( *pNode, [&f](node_type& node) { cds::unref(f)( node.m_Value ) ; } )) {
+ if ( base_class::insert( *pNode, [&f](node_type& node) { f( node.m_Value ) ; } )) {
pNode.release();
return true;
}
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
The function applies RCU lock internally.
std::pair<bool, bool> bRet = base_class::ensure( *pNode,
[&func, &val]( bool bNew, node_type& item, node_type const& /*val*/ ) {
- cds::unref(func)( bNew, item.m_Value, val );
+ func( bNew, item.m_Value, val );
} );
if ( bRet.first && bRet.second )
pNode.release();
template <typename Q, typename Func>
bool erase( Q const& key, Func f )
{
- return base_class::erase( key, [&f](node_type& node) { cds::unref(f)( node.m_Value ); } );
+ return base_class::erase( key, [&f](node_type& node) { f( node.m_Value ); } );
}
/// Deletes the item from the set using \p pred predicate for searching
bool erase_with( Q const& key, Less pred, Func f )
{
return base_class::erase_with( key, typename maker::template predicate_wrapper<Less>::type(),
- [&f](node_type& node) { cds::unref(f)( node.m_Value ); } );
+ [&f](node_type& node) { f( node.m_Value ); } );
}
/// Extracts an item from the set
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
- <tt>item.first</tt> is a const reference to item's key that cannot be changed.
- <tt>item.second</tt> is a reference to item's value that may be changed.
- The user-defined functor can be passed by reference using <tt>boost::ref</tt>
+ The user-defined functor can be passed by reference using \p std::ref
and it is called only if inserting is successful.
The key_type should be constructible from value of type \p K.
The functor may change any fields of the \p item.second that is \ref mapped_type.
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found.
- You can pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by reference using \p std::ref.
The functor may change \p item.second.
template <typename K, typename Func>
bool find( K const& key, Func f )
{
- return base_class::find( key, [&f]( value_type& pair, K const& ) mutable { cds::unref(f)(pair); } );
+ return base_class::find( key, [&f]( value_type& pair, K const& ) mutable { f(pair); } );
}
/// Find the key \p val using \p pred predicate
bool find_with( K const& key, Less pred, Func f )
{
return base_class::find_with( key, cds::details::predicate_wrapper< value_type, Less, key_accessor >(),
- [&f]( value_type& pair, K const& ) mutable { cds::unref(f)(pair); } );
+ [&f]( value_type& pair, K const& ) mutable { f(pair); } );
}
/// Find the key \p key
# error "For boost::container::list you must use boost 1.48 or above"
#endif
-#include <cds/container/striped_set/adapter.h>
-#include <cds/ref.h>
-#include <boost/container/list.hpp>
+#include <functional> // ref
#include <algorithm> // std::lower_bound
#include <utility> // std::pair
+#include <cds/container/striped_set/adapter.h>
+#include <boost/container/list.hpp>
//@cond
namespace cds { namespace container {
if ( it == m_List.end() || key_comparator()( key, it->first ) != 0 ) {
//value_type newItem( key );
it = m_List.insert( it, value_type( key, mapped_type()) );
- cds::unref( f )( *it );
+ f( *it );
return true;
}
// insert new
value_type newItem( key, mapped_type() );
it = m_List.insert( it, newItem );
- cds::unref( func )( true, *it );
+ func( true, *it );
return std::make_pair( true, true );
}
else {
// already exists
- cds::unref( func )( false, *it );
+ func( false, *it );
return std::make_pair( true, false );
}
}
return false;
// key exists
- cds::unref( f )( *it );
+ f( *it );
m_List.erase( it );
return true;
return false;
// key exists
- cds::unref( f )( *it );
+ f( *it );
m_List.erase( it );
return true;
return false;
// key exists
- cds::unref( f )( *it, val );
+ f( *it, val );
return true;
}
return false;
// key exists
- cds::unref( f )( *it, val );
+ f( *it, val );
return true;
}
# error "For boost::container::slist you must use boost 1.48 or above"
#endif
+#include <functional> // ref
+#include <utility> // std::pair
#include <cds/container/striped_set/adapter.h>
-#include <cds/ref.h>
#include <boost/container/slist.hpp>
-#include <utility> // std::pair
//@cond
namespace cds { namespace container {
if ( !pos.second ) {
value_type newItem( key, mapped_type() );
pos.first = m_List.insert_after( pos.first, newItem );
- cds::unref( f )( *pos.first );
+ f( *pos.first );
return true;
}
// insert new
value_type newItem( key, mapped_type() );
pos.first = m_List.insert_after( pos.first, newItem );
- cds::unref( func )( true, *pos.first );
+ func( true, *pos.first );
return std::make_pair( true, true );
}
else {
// already exists
- cds::unref( func )( false, *(++pos.first) );
+ func( false, *(++pos.first) );
return std::make_pair( true, false );
}
}
// key exists
iterator it = pos.first;
- cds::unref( f )( *(++it) );
+ f( *(++it) );
m_List.erase_after( pos.first );
return true;
// key exists
iterator it = pos.first;
- cds::unref( f )( *(++it) );
+ f( *(++it) );
m_List.erase_after( pos.first );
return true;
return false;
// key exists
- cds::unref( f )( *(++pos.first), val );
+ f( *(++pos.first), val );
return true;
}
return false;
// key exists
- cds::unref( f )( *(++pos.first), val );
+ f( *(++pos.first), val );
return true;
}
{
std::pair<iterator, bool> res = m_Map.insert( value_type( key, mapped_type() ));
if ( res.second )
- ::cds::unref(f)( const_cast<value_type&>(*res.first) );
+ ::f( const_cast<value_type&>(*res.first) );
return res.second;
}
std::pair<bool, bool> ensure( const Q& key, Func func )
{
std::pair<iterator, bool> res = m_Map.insert( value_type( key, mapped_type() ) );
- cds::unref(func)( res.second, const_cast<value_type&>(*res.first));
+ func( res.second, const_cast<value_type&>(*res.first));
return std::make_pair( true, res.second );
}
iterator it = m_Map.find( key_type(key) );
if ( it == m_Map.end() )
return false;
- ::cds::unref(f)( const_cast<value_type&>(*it) );
+ ::f( const_cast<value_type&>(*it) );
m_Map.erase( it );
return true;
}
iterator it = m_Map.find( key_type(val) );
if ( it == m_Map.end() )
return false;
- ::cds::unref(f)( const_cast<value_type&>(*it), val );
+ ::f( const_cast<value_type&>(*it), val );
return true;
}
{
std::pair<iterator, bool> res = m_Map.insert( value_type( key, mapped_type() ) );
if ( res.second )
- ::cds::unref(f)( *res.first );
+ ::f( *res.first );
return res.second;
}
std::pair<bool, bool> ensure( const Q& val, Func func )
{
std::pair<iterator, bool> res = m_Map.insert( value_type( val, mapped_type() ));
- ::cds::unref(func)( res.second, *res.first );
+ ::func( res.second, *res.first );
return std::make_pair( true, res.second );
}
iterator it = m_Map.find( key_type(key) );
if ( it == m_Map.end() )
return false;
- ::cds::unref(f)( *it );
+ ::f( *it );
m_Map.erase( it );
return true;
}
iterator it = m_Map.find( key_type(val) );
if ( it == m_Map.end() )
return false;
- ::cds::unref(f)( *it, val );
+ ::f( *it, val );
return true;
}
#ifndef __CDS_CONTAINER_STRIPED_MAP_STD_LIST_ADAPTER_H
#define __CDS_CONTAINER_STRIPED_MAP_STD_LIST_ADAPTER_H
-#include <cds/container/striped_set/adapter.h>
-#include <cds/ref.h>
#include <list>
+#include <functional> // ref
#include <algorithm> // std::lower_bound
#include <utility> // std::pair
+#include <cds/container/striped_set/adapter.h>
//@cond
namespace cds { namespace container {
if ( it == m_List.end() || key_comparator()( key, it->first ) != 0 ) {
//value_type newItem( key );
it = m_List.insert( it, value_type( key, mapped_type()) );
- cds::unref( f )( *it );
+ f( *it );
# ifdef __GLIBCXX__
++m_nSize;
// insert new
value_type newItem( key, mapped_type() );
it = m_List.insert( it, newItem );
- cds::unref( func )( true, *it );
+ func( true, *it );
# ifdef __GLIBCXX__
++m_nSize;
# endif
}
else {
// already exists
- cds::unref( func )( false, *it );
+ func( false, *it );
return std::make_pair( true, false );
}
}
return false;
// key exists
- cds::unref( f )( *it );
+ f( *it );
m_List.erase( it );
# ifdef __GLIBCXX__
--m_nSize;
return false;
// key exists
- cds::unref( f )( *it );
+ f( *it );
m_List.erase( it );
# ifdef __GLIBCXX__
--m_nSize;
return false;
// key exists
- cds::unref( f )( *it, val );
+ f( *it, val );
return true;
}
return false;
// key exists
- cds::unref( f )( *it, val );
+ f( *it, val );
return true;
}
{
std::pair<iterator, bool> res = m_Map.insert( value_type( key, mapped_type() ) );
if ( res.second )
- ::cds::unref(f)( *res.first );
+ ::f( *res.first );
return res.second;
}
std::pair<bool, bool> ensure( const Q& key, Func func )
{
std::pair<iterator, bool> res = m_Map.insert( value_type( key, mapped_type() ));
- cds::unref(func)( res.second, *res.first );
+ func( res.second, *res.first );
return std::make_pair( true, res.second );
}
iterator it = m_Map.find( key_type(key) );
if ( it == m_Map.end() )
return false;
- cds::unref(f)( *it );
+ f( *it );
m_Map.erase( it );
return true;
}
iterator it = m_Map.find( key_type(val) );
if ( it == m_Map.end() )
return false;
- cds::unref(f)( *it, val );
+ f( *it, val );
return true;
}
Therefore, the \p value_type should be constructible from type \p Q.
The user-defined functor is called only if the inserting is success. It can be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
*/
template <typename Q, typename Func>
bool insert( Q const& val, Func f )
The functor can change non-key fields of the \p item.
- You can pass \p func argument by value or by reference using <tt>boost::ref</tt>.
+ You can pass \p func argument by value or by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p val key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item.
The \p val argument is non-const since it can be used as \p f functor destination i.e., the functor
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item.
Therefore, the \p value_type should be comparable with type \p Q and constructible from type \p Q,
The user-defined functor is called only if the inserting is success. It can be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
<hr>
<b>Inserts data of type \ref value_type constructed with <tt>std::forward<Args>(args)...</tt></b>
The type \p Q can differ from \ref value_type of items storing in the container.
Therefore, the \p value_type should be comparable with type \p Q and constructible from type \p Q,
- You can pass \p func argument by reference using <tt>boost::ref</tt>.
+ You can pass \p func argument by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p val key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by reference using \p std::ref
The functor can change non-key fields of \p item.
The \p val argument is non-const since it can be used as \p f functor destination i.e., the functor
{
std::pair<iterator, bool> res = m_Set.insert( value_type(val) );
if ( res.second )
- cds::unref(f)( const_cast<value_type&>(*res.first) );
+ f( const_cast<value_type&>(*res.first) );
return res.second;
}
std::pair<bool, bool> ensure( const Q& val, Func func )
{
std::pair<iterator, bool> res = m_Set.insert( value_type(val) );
- cds::unref(func)( res.second, const_cast<value_type&>(*res.first), val );
+ func( res.second, const_cast<value_type&>(*res.first), val );
return std::make_pair( true, res.second );
}
const_iterator it = m_Set.find( value_type(key) );
if ( it == m_Set.end() )
return false;
- cds::unref(f)( const_cast<value_type&>(*it) );
+ f( const_cast<value_type&>(*it) );
m_Set.erase( it );
return true;
}
iterator it = m_Set.find( value_type(val) );
if ( it == m_Set.end() )
return false;
- cds::unref(f)( const_cast<value_type&>(*it), val );
+ f( const_cast<value_type&>(*it), val );
return true;
}
{
std::pair<iterator, bool> res = m_Map.insert( value_type( key, mapped_type() ) );
if ( res.second )
- cds::unref(f)( *res.first );
+ f( *res.first );
return res.second;
}
std::pair<bool, bool> ensure( const Q& val, Func func )
{
std::pair<iterator, bool> res = m_Map.insert( value_type( val, mapped_type() ));
- cds::unref(func)( res.second, *res.first );
+ func( res.second, *res.first );
return std::make_pair( true, res.second );
}
iterator it = m_Map.find( key_type(key) );
if ( it == m_Map.end() )
return false;
- cds::unref(f)( *it );
+ f( *it );
m_Map.erase( it );
return true;
}
iterator it = m_Map.find( key_type(val) );
if ( it == m_Map.end() )
return false;
- cds::unref(f)( *it, val );
+ f( *it, val );
return true;
}
# error "For boost::container::list you must use boost 1.48 or above"
#endif
+#include <algorithm> // std::lower_bound
+#include <functional> // ref
#include <cds/container/striped_set/adapter.h>
-#include <cds/ref.h>
#include <boost/container/list.hpp>
-#include <algorithm> // std::lower_bound
//@cond
namespace cds { namespace container {
if ( it == m_List.end() || key_comparator()( val, *it ) != 0 ) {
value_type newItem( val );
it = m_List.insert( it, newItem );
- cds::unref( f )( *it );
+ f( *it );
return true;
}
// insert new
value_type newItem( val );
it = m_List.insert( it, newItem );
- cds::unref( func )( true, *it, val );
+ func( true, *it, val );
return std::make_pair( true, true );
}
else {
// already exists
- cds::unref( func )( false, *it, val );
+ func( false, *it, val );
return std::make_pair( true, false );
}
}
return false;
// key exists
- cds::unref( f )( *it );
+ f( *it );
m_List.erase( it );
return true;
return false;
// key exists
- cds::unref( f )( *it );
+ f( *it );
m_List.erase( it );
return true;
return false;
// key exists
- cds::unref( f )( *it, val );
+ f( *it, val );
return true;
}
return false;
// key exists
- cds::unref( f )( *it, val );
+ f( *it, val );
return true;
}
#ifndef __CDS_CONTAINER_STRIPED_SET_BOOST_SLIST_ADAPTER_H
#define __CDS_CONTAINER_STRIPED_SET_BOOST_SLIST_ADAPTER_H
+#include <functional> // ref
#include <cds/container/striped_set/adapter.h>
-#include <cds/ref.h>
#include <boost/container/slist.hpp>
//@cond
if ( !pos.second ) {
value_type newItem( val );
pos.first = m_List.insert_after( pos.first, newItem );
- cds::unref( f )( *pos.first );
+ f( *pos.first );
return true;
}
// insert new
value_type newItem( val );
pos.first = m_List.insert_after( pos.first, newItem );
- cds::unref( func )( true, *pos.first, val );
+ func( true, *pos.first, val );
return std::make_pair( true, true );
}
else {
// already exists
- cds::unref( func )( false, *(++pos.first), val );
+ func( false, *(++pos.first), val );
return std::make_pair( true, false );
}
}
// key exists
iterator it = pos.first;
- cds::unref( f )( *(++it) );
+ f( *(++it) );
m_List.erase_after( pos.first );
return true;
// key exists
iterator it = pos.first;
- cds::unref( f )( *(++it) );
+ f( *(++it) );
m_List.erase_after( pos.first );
return true;
return false;
// key exists
- cds::unref( f )( *(++pos.first), val );
+ f( *(++pos.first), val );
return true;
}
return false;
// key exists
- cds::unref( f )( *(++pos.first), val );
+ f( *(++pos.first), val );
return true;
}
# error "For boost::container::stable_vector you must use boost 1.48 or above"
#endif
-#include <cds/container/striped_set/adapter.h>
-#include <cds/ref.h>
-#include <boost/container/stable_vector.hpp>
+#include <functional> // ref
#include <algorithm> // std::lower_bound
#include <utility> // std::pair
+#include <cds/container/striped_set/adapter.h>
+#include <boost/container/stable_vector.hpp>
//@cond
namespace cds { namespace container {
Therefore, the \p value_type should be comparable with type \p Q and constructible from type \p Q,
The user-defined functor is called only if the inserting is success. It may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
*/
template <typename Q, typename Func>
bool insert( const Q& val, Func f )
if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) {
value_type newItem( val );
it = m_Vector.insert( it, newItem );
- cds::unref( f )( *it );
+ f( *it );
return true;
}
return false;
The type \p Q may differ from \ref value_type of items storing in the container.
Therefore, the \p value_type should be comparable with type \p Q and constructible from type \p Q,
- You may pass \p func argument by reference using <tt>boost::ref</tt>.
+ You may pass \p func argument by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p val key
// insert new
value_type newItem( val );
it = m_Vector.insert( it, newItem );
- cds::unref( func )( true, *it, val );
+ func( true, *it, val );
return std::make_pair( true, true );
}
else {
// already exists
- cds::unref( func )( false, *it, val );
+ func( false, *it, val );
return std::make_pair( true, false );
}
}
return false;
// key exists
- cds::unref( f )( *it );
+ f( *it );
m_Vector.erase( it );
return true;
}
return false;
// key exists
- cds::unref( f )( *it );
+ f( *it );
m_Vector.erase( it );
return true;
}
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref
The functor may change non-key fields of \p item.
The \p val argument is non-const since it can be used as \p f functor destination i.e., the functor
return false;
// key exists
- cds::unref( f )( *it, val );
+ f( *it, val );
return true;
}
return false;
// key exists
- cds::unref( f )( *it, val );
+ f( *it, val );
return true;
}
# error "For boost::container::vector you must use boost 1.48 or above"
#endif
-#include <cds/container/striped_set/adapter.h> // lower_bound
-#include <cds/ref.h>
-#include <boost/container/vector.hpp>
+#include <functional> // ref
#include <algorithm> // std::lower_bound
#include <utility> // std::pair
+#include <cds/container/striped_set/adapter.h> // lower_bound
+#include <boost/container/vector.hpp>
//@cond
namespace cds { namespace container {
if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) {
value_type newItem( val );
it = m_Vector.insert( it, newItem );
- cds::unref( f )( *it );
+ f( *it );
return true;
}
return false;
// insert new
value_type newItem( val );
it = m_Vector.insert( it, newItem );
- cds::unref( func )( true, *it, val );
+ func( true, *it, val );
return std::make_pair( true, true );
}
else {
// already exists
- cds::unref( func )( false, *it, val );
+ func( false, *it, val );
return std::make_pair( true, false );
}
}
return false;
// key exists
- cds::unref( f )( *it );
+ f( *it );
m_Vector.erase( it );
return true;
}
return false;
// key exists
- cds::unref( f )( *it );
+ f( *it );
m_Vector.erase( it );
return true;
}
return false;
// key exists
- cds::unref( f )( *it, val );
+ f( *it, val );
return true;
}
return false;
// key exists
- cds::unref( f )( *it, val );
+ f( *it, val );
return true;
}
{
std::pair<iterator, bool> res = m_Set.insert( value_type(val) );
if ( res.second )
- ::cds::unref(f)( const_cast<value_type&>(*res.first) );
+ ::f( const_cast<value_type&>(*res.first) );
return res.second;
}
std::pair<bool, bool> ensure( const Q& val, Func func )
{
std::pair<iterator, bool> res = m_Set.insert( value_type(val) );
- cds::unref(func)( res.second, const_cast<value_type&>(*res.first), val );
+ func( res.second, const_cast<value_type&>(*res.first), val );
return std::make_pair( true, res.second );
}
const_iterator it = m_Set.find( value_type(key) );
if ( it == m_Set.end() )
return false;
- cds::unref(f)( const_cast<value_type&>(*it) );
+ f( const_cast<value_type&>(*it) );
m_Set.erase( it );
return true;
}
iterator it = m_Set.find( value_type(val) );
if ( it == m_Set.end() )
return false;
- cds::unref(f)( const_cast<value_type&>(*it), val );
+ f( const_cast<value_type&>(*it), val );
return true;
}
{
std::pair<iterator, bool> res = m_Set.insert( value_type(val) );
if ( res.second )
- ::cds::unref(f)( *res.first );
+ ::f( *res.first );
return res.second;
}
std::pair<bool, bool> ensure( const Q& val, Func func )
{
std::pair<iterator, bool> res = m_Set.insert( value_type(val) );
- ::cds::unref(func)( res.second, *res.first, val );
+ ::func( res.second, *res.first, val );
return std::make_pair( true, res.second );
}
iterator it = m_Set.find( value_type(key) );
if ( it == m_Set.end() )
return false;
- ::cds::unref(f)( *it );
+ ::f( *it );
m_Set.erase( it );
return true;
}
iterator it = m_Set.find( value_type(val) );
if ( it == m_Set.end() )
return false;
- ::cds::unref(f)( *it, val );
+ ::f( *it, val );
return true;
}
#ifndef __CDS_CONTAINER_STRIPED_SET_STD_LIST_ADAPTER_H
#define __CDS_CONTAINER_STRIPED_SET_STD_LIST_ADAPTER_H
-#include <cds/container/striped_set/adapter.h>
-#include <cds/ref.h>
+#include <functional> // ref
#include <list>
#include <algorithm> // std::lower_bound
+#include <cds/container/striped_set/adapter.h>
//@cond
namespace cds { namespace container {
if ( it == m_List.end() || key_comparator()( val, *it ) != 0 ) {
value_type newItem( val );
it = m_List.insert( it, newItem );
- cds::unref( f )( *it );
+ f( *it );
# ifdef __GLIBCXX__
++m_nSize;
// insert new
value_type newItem( val );
it = m_List.insert( it, newItem );
- cds::unref( func )( true, *it, val );
+ func( true, *it, val );
# ifdef __GLIBCXX__
++m_nSize;
# endif
}
else {
// already exists
- cds::unref( func )( false, *it, val );
+ func( false, *it, val );
return std::make_pair( true, false );
}
}
return false;
// key exists
- cds::unref( f )( *it );
+ f( *it );
m_List.erase( it );
# ifdef __GLIBCXX__
--m_nSize;
return false;
// key exists
- cds::unref( f )( *it );
+ f( *it );
m_List.erase( it );
# ifdef __GLIBCXX__
--m_nSize;
return false;
// key exists
- cds::unref( f )( *it, val );
+ f( *it, val );
return true;
}
return false;
// key exists
- cds::unref( f )( *it, val );
+ f( *it, val );
return true;
}
{
std::pair<iterator, bool> res = m_Set.insert( value_type(val) );
if ( res.second )
- ::cds::unref(f)( const_cast<value_type&>(*res.first) );
+ ::f( const_cast<value_type&>(*res.first) );
return res.second;
}
std::pair<bool, bool> ensure( const Q& val, Func func )
{
std::pair<iterator, bool> res = m_Set.insert( value_type(val) );
- ::cds::unref(func)( res.second, const_cast<value_type&>(*res.first), val );
+ ::func( res.second, const_cast<value_type&>(*res.first), val );
return std::make_pair( true, res.second );
}
iterator it = m_Set.find( value_type(key) );
if ( it == m_Set.end() )
return false;
- ::cds::unref(f)( const_cast<value_type&>(*it) );
+ ::f( const_cast<value_type&>(*it) );
m_Set.erase( it );
return true;
}
iterator it = m_Set.find( value_type(val) );
if ( it == m_Set.end() )
return false;
- ::cds::unref(f)( const_cast<value_type&>(*it), val );
+ ::f( const_cast<value_type&>(*it), val );
return true;
}
#ifndef __CDS_CONTAINER_STRIPED_SET_STD_VECTOR_ADAPTER_H
#define __CDS_CONTAINER_STRIPED_SET_STD_VECTOR_ADAPTER_H
-#include <cds/container/striped_set/adapter.h> // lower_bound
-#include <cds/ref.h>
+#include <functional> // ref
#include <vector>
#include <algorithm> // std::lower_bound
#include <utility> // std::pair
+#include <cds/container/striped_set/adapter.h> // lower_bound
//@cond
namespace cds { namespace container {
if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) {
value_type newItem( val );
it = m_Vector.insert( it, newItem );
- cds::unref( f )( *it );
+ f( *it );
return true;
}
return false;
// insert new
value_type newItem( val );
it = m_Vector.insert( it, newItem );
- cds::unref( func )( true, *it, val );
+ func( true, *it, val );
return std::make_pair( true, true );
}
else {
// already exists
- cds::unref( func )( false, *it, val );
+ func( false, *it, val );
return std::make_pair( true, false );
}
}
return false;
// key exists
- cds::unref( f )( *it );
+ f( *it );
m_Vector.erase( it );
return true;
}
return false;
// key exists
- cds::unref( f )( *it );
+ f( *it );
m_Vector.erase( it );
return true;
}
return false;
// key exists
- cds::unref( f )( *it, val );
+ f( *it, val );
return true;
}
return false;
// key exists
- cds::unref( f )( *it, val );
+ f( *it, val );
return true;
}
bool enqueue( const Type& data, Func f )
{
scoped_node_ptr p( alloc_node());
- unref(f)( *p, data );
+ f( *p, data );
if ( base_class::enqueue( *p )) {
p.release();
return true;
{
value_type * p = base_class::dequeue();
if ( p ) {
- unref(f)( dest, *p );
+ f( dest, *p );
node_disposer()( p );
return true;
}
#ifndef __CDS_CONTAINER_VYUKOV_MPMC_CYCLE_QUEUE_H
#define __CDS_CONTAINER_VYUKOV_MPMC_CYCLE_QUEUE_H
+#include <functional> // ref
#include <cds/container/details/base.h>
#include <cds/opt/buffer.h>
#include <cds/opt/value_cleaner.h>
#include <cds/cxx11_atomic.h>
-#include <cds/ref.h>
#include <cds/details/trivial_assign.h>
#include <cds/details/bounded_container.h>
pos = m_posEnqueue.load(memory_model::memory_order_relaxed);
}
- unref(func)( cell->data, data );
+ func( cell->data, data );
cell->sequence.store(pos + 1, memory_model::memory_order_release);
++m_ItemCounter;
pos = m_posDequeue.load(memory_model::memory_order_relaxed);
}
- unref(func)( data, cell->data );
+ func( data, cell->data );
value_cleaner()( cell->data );
--m_ItemCounter;
cell->sequence.store( pos + m_nBufferMask + 1, memory_model::memory_order_release );
#ifndef __CDS_DETAILS_FUNCTOR_WRAPPER_H
#define __CDS_DETAILS_FUNCTOR_WRAPPER_H
-#include <cds/ref.h>
+#include <functional> // ref
//@cond
namespace cds { namespace details {
#define __CDS_INTRUSIVE_BASKET_QUEUE_H
#include <type_traits>
+#include <functional> // ref
#include <cds/intrusive/details/base.h>
#include <cds/details/marked_ptr.h>
#include <cds/intrusive/details/queue_stat.h>
#include <cds/intrusive/details/single_link_struct.h>
-#include <cds/ref.h>
#include <cds/intrusive/details/dummy_node_holder.h>
namespace cds { namespace intrusive {
#include <memory>
#include <type_traits>
#include <mutex>
+#include <functional> // ref
#include <cds/intrusive/details/base.h>
#include <cds/opt/compare.h>
#include <cds/opt/hash.h>
#include <cds/lock/array.h>
-#include <cds/ref.h>
#include <cds/os/thread.h>
#include <cds/details/functor_wrapper.h>
#include <cds/lock/spinlock.h>
for ( node_type * pNode = pHead; pNode; pNode = pNext ) {
pNext = pNode->m_pNext;
pNode->clear();
- cds::unref(disp)( pNode );
+ disp( pNode );
}
nSize = 0;
void clear( Disposer disp )
{
for ( unsigned int i = 0; i < m_nSize; ++i ) {
- cds::unref(disp)( m_arrNode[i] );
+ disp( m_arrNode[i] );
}
m_nSize = 0;
}
unsigned int nTable = contains( arrPos, arrHash, val, pred );
if ( nTable != c_nUndefTable ) {
node_type& node = *arrPos[nTable].itFound;
- cds::unref(f)( *node_traits::to_value_ptr(node) );
+ f( *node_traits::to_value_ptr(node) );
bucket( nTable, arrHash[nTable]).remove( arrPos[nTable].itPrev, arrPos[nTable].itFound );
--m_ItemCounter;
m_Stat.onEraseSuccess();
unsigned int nTable = contains( arrPos, arrHash, val, pred );
if ( nTable != c_nUndefTable ) {
- cds::unref(f)( *node_traits::to_value_ptr( *arrPos[nTable].itFound ), val );
+ f( *node_traits::to_value_ptr( *arrPos[nTable].itFound ), val );
m_Stat.onFindSuccess();
return true;
}
where \p val is the item inserted.
The user-defined functor is called only if the inserting is success and can be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
*/
template <typename Func>
bool insert( value_type& val, Func f )
bucket_entry& refBucket = bucket( i, arrHash[i] );
if ( refBucket.size() < m_nProbesetThreshold ) {
refBucket.insert_after( arrPos[i].itPrev, pNode );
- cds::unref(f)( val );
+ f( val );
++m_ItemCounter;
m_Stat.onInsertSuccess();
return true;
bucket_entry& refBucket = bucket( i, arrHash[i] );
if ( refBucket.size() < m_nProbesetSize ) {
refBucket.insert_after( arrPos[i].itPrev, pNode );
- cds::unref(f)( val );
+ f( val );
++m_ItemCounter;
nGoalTable = i;
assert( refBucket.size() > 1 );
The functor may change non-key fields of the \p item.
- You may pass \p func argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p func argument by reference using \p std::ref.
Returns <tt> std::pair<bool, bool> </tt> where \p first is \p true if operation is successful,
\p second is \p true if new item has been added or \p false if the item with \p key
unsigned int nTable = contains( arrPos, arrHash, val, key_predicate() );
if ( nTable != c_nUndefTable ) {
- cds::unref(func)( false, *node_traits::to_value_ptr( *arrPos[nTable].itFound ), val );
+ func( false, *node_traits::to_value_ptr( *arrPos[nTable].itFound ), val );
m_Stat.onEnsureExist();
return std::make_pair( true, false );
}
bucket_entry& refBucket = bucket( i, arrHash[i] );
if ( refBucket.size() < m_nProbesetThreshold ) {
refBucket.insert_after( arrPos[i].itPrev, pNode );
- cds::unref(func)( true, val, val );
+ func( true, val, val );
++m_ItemCounter;
m_Stat.onEnsureSuccess();
return std::make_pair( true, true );
bucket_entry& refBucket = bucket( i, arrHash[i] );
if ( refBucket.size() < m_nProbesetSize ) {
refBucket.insert_after( arrPos[i].itPrev, pNode );
- cds::unref(func)( true, val, val );
+ func( true, val, val );
++m_ItemCounter;
nGoalTable = i;
assert( refBucket.size() > 1 );
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item.
#ifndef __CDS_INTRUSIVE_DETAILS_LAZY_LIST_BASE_H
#define __CDS_INTRUSIVE_DETAILS_LAZY_LIST_BASE_H
+#include <functional> // ref
#include <cds/intrusive/details/base.h>
#include <cds/opt/compare.h>
#include <cds/details/marked_ptr.h>
-#include <cds/ref.h>
#include <cds/details/make_const_type.h>
#include <boost/type_traits/is_same.hpp>
#include <cds/lock/spinlock.h>
#define __CDS_INTRUSIVE_DETAILS_MICHAEL_LIST_BASE_H
#include <type_traits>
+#include <functional> // ref
#include <cds/intrusive/details/base.h>
#include <cds/opt/compare.h>
#include <cds/cxx11_atomic.h>
#include <cds/details/marked_ptr.h>
-#include <cds/ref.h>
#include <cds/details/make_const_type.h>
#include <cds/urcu/options.h>
#ifndef __CDS_INTRUSIVE_DETAILS_MICHAEL_SET_BASE_H
#define __CDS_INTRUSIVE_DETAILS_MICHAEL_SET_BASE_H
+#include <functional> // ref
#include <cds/intrusive/details/base.h>
#include <cds/opt/compare.h>
#include <cds/opt/hash.h>
#include <cds/algo/bitop.h>
#include <cds/cxx11_atomic.h>
-#include <cds/ref.h>
namespace cds { namespace intrusive {
#define __CDS_INTRUSIVE_ELLEN_BINTREE_RCU_H
#include <memory>
+#include <functional> // ref
#include <cds/intrusive/details/ellen_bintree_base.h>
#include <cds/opt/compare.h>
-#include <cds/ref.h>
#include <cds/details/binary_functor_wrapper.h>
#include <cds/urcu/details/check_deadlock.h>
#include <cds/urcu/exempt_ptr.h>
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this tree's item by concurrent threads.
The user-defined functor is called only if the inserting is success and may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
RCU \p synchronize method can be called. RCU should not be locked.
*/
pNewInternal.reset( alloc_internal_node() );
if ( try_insert( val, pNewInternal.get(), res, updRetire )) {
- cds::unref(f)( val );
+ f( val );
pNewInternal.release() ; // internal node is linked into the tree and should not be deleted
break;
}
The functor can change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You can pass \p func argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p func argument by value or by reference using \p std::ref.
RCU \p synchronize method can be called. RCU should not be locked.
search_result res;
for ( ;; ) {
if ( search( res, val, node_compare() )) {
- cds::unref(func)( false, *node_traits::to_value_ptr( res.pLeaf ), val );
+ func( false, *node_traits::to_value_ptr( res.pLeaf ), val );
if ( pNewInternal.get() )
m_Stat.onInternalNodeDeleted() ; // unique_internal_node_ptr deletes internal node
m_Stat.onEnsureExist();
pNewInternal.reset( alloc_internal_node() );
if ( try_insert( val, pNewInternal.get(), res, updRetire )) {
- cds::unref(func)( true, val, val );
+ func( true, val, val );
pNewInternal.release() ; // internal node is linked into the tree and should not be deleted
break;
}
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
{
if ( help_delete( pOp, updRetire )) {
// res.pLeaf is not deleted yet since RCU is blocked
- cds::unref(f)( *node_traits::to_value_ptr( res.pLeaf ));
+ f( *node_traits::to_value_ptr( res.pLeaf ));
break;
}
pOp = nullptr;
search_result res;
if ( search( res, val, compare_functor() )) {
assert( res.pLeaf );
- cds::unref(f)( *node_traits::to_value_ptr( res.pLeaf ), val );
+ f( *node_traits::to_value_ptr( res.pLeaf ), val );
m_Stat.onFindSuccess();
return true;
search_result res;
if ( search( res, key, node_compare() )) {
assert( res.pLeaf );
- cds::unref(f)( *node_traits::to_value_ptr( res.pLeaf ), key );
+ f( *node_traits::to_value_ptr( res.pLeaf ), key );
m_Stat.onFindSuccess();
return true;
#define __CDS_INTRUSIVE_IMPL_ELLEN_BINTREE_H
#include <memory>
+#include <functional> // ref
#include <cds/intrusive/details/ellen_bintree_base.h>
#include <cds/opt/compare.h>
-#include <cds/ref.h>
#include <cds/details/binary_functor_wrapper.h>
#include <cds/urcu/details/check_deadlock.h>
#include <cds/gc/guarded_ptr.h>
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this tree's item by concurrent threads.
The user-defined functor is called only if the inserting is success and may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
*/
template <typename Func>
bool insert( value_type& val, Func f )
pNewInternal.reset( alloc_internal_node() );
if ( try_insert( val, pNewInternal.get(), res )) {
- cds::unref(f)( val );
+ f( val );
pNewInternal.release(); // internal node is linked into the tree and should not be deleted
break;
}
The functor can change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You can pass \p func argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p func argument by value or by reference using \p std::ref.
Returns std::pair<bool, bool> where \p first is \p true if operation is successfull,
\p second is \p true if new item has been added or \p false if the item with \p key
search_result res;
for ( ;; ) {
if ( search( res, val, node_compare() )) {
- cds::unref(func)( false, *node_traits::to_value_ptr( res.pLeaf ), val );
+ func( false, *node_traits::to_value_ptr( res.pLeaf ), val );
if ( pNewInternal.get() )
m_Stat.onInternalNodeDeleted() ; // unique_internal_node_ptr deletes internal node
m_Stat.onEnsureExist();
pNewInternal.reset( alloc_internal_node() );
if ( try_insert( val, pNewInternal.get(), res )) {
- cds::unref(func)( true, val, val );
+ func( true, val, val );
pNewInternal.release() ; // internal node has been linked into the tree and should not be deleted
break;
}
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
{
if ( help_delete( pOp )) {
// res.pLeaf is not deleted yet since it is guarded
- cds::unref(f)( *node_traits::to_value_ptr( res.pLeaf ));
+ f( *node_traits::to_value_ptr( res.pLeaf ));
break;
}
pOp = nullptr;
search_result res;
if ( search( res, val, node_compare() )) {
assert( res.pLeaf );
- cds::unref(f)( *node_traits::to_value_ptr( res.pLeaf ), val );
+ f( *node_traits::to_value_ptr( res.pLeaf ), val );
m_Stat.onFindSuccess();
return true;
search_result res;
if ( search( res, val, compare_functor() )) {
assert( res.pLeaf );
- cds::unref(f)( *node_traits::to_value_ptr( res.pLeaf ), val );
+ f( *node_traits::to_value_ptr( res.pLeaf ), val );
m_Stat.onFindSuccess();
return true;
where \p val is the item inserted.
While the functor \p f is working the item \p val is locked.
The user-defined functor is called only if the inserting is success and may be passed by reference
- using <tt>boost::ref</tt>.
+ using \p std::ref
*/
template <typename Func>
bool insert( value_type& val, Func f )
The functor may change non-key fields of the \p item.
While the functor \p f is working the item \p item is locked.
- You may pass \p func argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p func argument by reference using \p std::ref.
Returns std::pair<bool, bool> where \p first is \p true if operation is successfull,
\p second is \p true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ 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 \p item is locked.
\endcode
where \p item is the item found, \p val is the \p find function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ 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 \p item is locked.
}
else {
link_node( node_traits::to_node_ptr( val ), pos.pPred, pos.pCur );
- cds::unref(f)( val );
+ f( val );
++m_ItemCounter;
return true;
}
if ( pos.pCur != tail() && cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 ) {
// key already in the list
- cds::unref(func)( false, *node_traits::to_value_ptr( *pos.pCur ) , val );
+ func( false, *node_traits::to_value_ptr( *pos.pCur ) , val );
return std::make_pair( true, false );
}
else {
link_checker::is_empty( node_traits::to_node_ptr( val ) );
link_node( node_traits::to_node_ptr( val ), pos.pPred, pos.pCur );
- cds::unref(func)( true, val, val );
+ func( true, val, val );
++m_ItemCounter;
return std::make_pair( true, true );
}
if ( pos.pCur != tail() && cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 ) {
// key found
unlink_node( pos.pPred, pos.pCur, pHead );
- cds::unref(f)( *node_traits::to_value_ptr( *pos.pCur ) );
+ f( *node_traits::to_value_ptr( *pos.pCur ) );
--m_ItemCounter;
nResult = 1;
}
if ( !pos.pCur->is_marked()
&& cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
{
- cds::unref(f)( *node_traits::to_value_ptr( *pos.pCur ), val );
+ f( *node_traits::to_value_ptr( *pos.pCur ), val );
return true;
}
}
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this list's item by concurrent threads.
The user-defined functor is called only if the inserting is success and may be passed by reference
- using <tt>boost::ref</tt>.
+ using \p std::ref
*/
template <typename Func>
bool insert( value_type& val, Func f )
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p func argument by reference using \p std::ref.
Returns std::pair<bool, bool> where \p first is \p true if operation is successfull,
\p second is \p true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the function is only guarantee
that \p item cannot be disposed during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the function is only guarantee
that \p item cannot be disposed during functor is executing.
typename gc::Guard guard;
guard.assign( &val );
if ( link_node( pNode, pos ) ) {
- cds::unref(f)( val );
+ f( val );
++m_ItemCounter;
return true;
}
}
assert( key_comparator()( val, *node_traits::to_value_ptr( *pos.pCur ) ) == 0 );
- unref(func)( false, *node_traits::to_value_ptr( *pos.pCur ) , val );
+ func( false, *node_traits::to_value_ptr( *pos.pCur ) , val );
return std::make_pair( true, false );
}
else {
guard.assign( &val );
if ( link_node( pNode, pos ) ) {
++m_ItemCounter;
- unref(func)( true, val, val );
+ func( true, val, val );
return std::make_pair( true, true );
}
// clear next field
back_off bkoff;
while ( search( refHead, val, pos, cmp )) {
if ( unlink_node( pos ) ) {
- cds::unref(f)( *node_traits::to_value_ptr( *pos.pCur ) );
+ f( *node_traits::to_value_ptr( *pos.pCur ) );
--m_ItemCounter;
return true;
}
{
position pos;
if ( search( refHead, val, pos, cmp )) {
- cds::unref(f)( *node_traits::to_value_ptr( *pos.pCur ), val );
+ f( *node_traits::to_value_ptr( *pos.pCur ), val );
return true;
}
return false;
#include <type_traits>
#include <memory>
+#include <functional> // ref
#include <cds/intrusive/details/skip_list_base.h>
#include <cds/opt/compare.h>
-#include <cds/ref.h>
#include <cds/details/binary_functor_wrapper.h>
#include <cds/gc/guarded_ptr.h>
if ( !pos.pPrev[0]->next(0).compare_exchange_strong( p, marked_node_ptr(pNode), memory_model::memory_order_release, atomics::memory_order_relaxed ) ) {
return false;
}
- cds::unref( f )( val );
+ f( val );
}
for ( unsigned int nLevel = 1; nLevel < nHeight; ++nLevel ) {
if ( pDel->next(0).compare_exchange_strong( p, marked_node_ptr(p.ptr(), 1),
memory_model::memory_order_acquire, atomics::memory_order_relaxed ))
{
- cds::unref(f)( *node_traits::to_value_ptr( pDel ));
+ f( *node_traits::to_value_ptr( pDel ));
// Physical deletion
// try fast erase
}
else if ( nCmp == 0 ) {
// found
- cds::unref(f)( *node_traits::to_value_ptr( pCur.ptr() ), val );
+ f( *node_traits::to_value_ptr( pCur.ptr() ), val );
return find_fastpath_found;
}
else // pCur > val - go down
if ( find_position( val, pos, cmp, true )) {
assert( cmp( *node_traits::to_value_ptr( pos.pCur ), val ) == 0 );
- cds::unref(f)( *node_traits::to_value_ptr( pos.pCur ), val );
+ f( *node_traits::to_value_ptr( pos.pCur ), val );
return true;
}
else
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
The user-defined functor is called only if the inserting is success and may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
*/
template <typename Func>
bool insert( value_type& val, Func f )
The functor can change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You can pass \p func argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p func argument by value or by reference using \p std::ref.
Returns std::pair<bool, bool> where \p first is \p true if operation is successfull,
\p second is \p true if new item has been added or \p false if the item with \p key
if ( !bTowerMade )
scp.release();
- cds::unref(func)( false, *node_traits::to_value_ptr(pos.pCur), val );
+ func( false, *node_traits::to_value_ptr(pos.pCur), val );
m_Stat.onEnsureExist();
return std::make_pair( true, false );
}
bTowerOk = true;
}
- if ( !insert_at_position( val, pNode, pos, [&func]( value_type& item ) { cds::unref(func)( true, item, item ); })) {
+ if ( !insert_at_position( val, pNode, pos, [&func]( value_type& item ) { func( true, item, item ); })) {
m_Stat.onInsertRetry();
continue;
}
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
void dispose_node( node_type * pNode, Disposer disp )
{
clear_links( pNode );
- cds::unref(disp)( node_traits::to_value_ptr( *pNode ));
+ disp( node_traits::to_value_ptr( *pNode ));
}
template <class Disposer>
The functor may change non-key fields of the \p item.
While the functor \p f is calling the item \p item is locked.
- You may pass \p func argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p func argument by reference using \p std::ref.
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ 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.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ 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.
if ( pos.pCur != &m_Tail && cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 ) {
// key already in the list
- cds::unref(func)( false, *node_traits::to_value_ptr( *pos.pCur ) , val );
+ func( false, *node_traits::to_value_ptr( *pos.pCur ) , val );
return std::make_pair( iterator( pos.pCur ), false );
}
else {
link_checker::is_empty( node_traits::to_node_ptr( val ) );
link_node( node_traits::to_node_ptr( val ), pos.pPred, pos.pCur );
- cds::unref(func)( true, val, val );
+ func( true, val, val );
++m_ItemCounter;
return std::make_pair( iterator( node_traits::to_node_ptr( val )), true );
}
cds::lock::scoped_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
if ( cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
{
- cds::unref(f)( *node_traits::to_value_ptr( *pos.pCur ), val );
+ f( *node_traits::to_value_ptr( *pos.pCur ), val );
return true;
}
}
where \p val is the item inserted.
While the functor \p f is working the item \p val is locked.
The user-defined functor is called only if the inserting is success and may be passed by reference
- using <tt>boost::ref</tt>.
+ using \p std::ref.
*/
template <typename Func>
bool insert( value_type& val, Func f )
The functor may change non-key fields of the \p item.
While the functor \p f is calling the item \p item is locked.
- You may pass \p func argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p func argument by reference using \p std::ref.
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ 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.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ 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.
}
else {
link_node( node_traits::to_node_ptr( val ), pos.pPred, pos.pCur );
- cds::unref(f)( val );
+ f( val );
++m_ItemCounter;
return true;
}
if ( pos.pCur != &m_Tail && cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 ) {
// key already in the list
- cds::unref(func)( false, *node_traits::to_value_ptr( *pos.pCur ) , val );
+ func( false, *node_traits::to_value_ptr( *pos.pCur ) , val );
return std::make_pair( iterator( pos.pCur ), false );
}
else {
link_checker::is_empty( node_traits::to_node_ptr( val ) );
link_node( node_traits::to_node_ptr( val ), pos.pPred, pos.pCur );
- cds::unref(func)( true, val, val );
+ func( true, val, val );
++m_ItemCounter;
return std::make_pair( iterator( node_traits::to_node_ptr( val )), true );
}
if ( pos.pCur != &m_Tail && cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 ) {
// key found
unlink_node( pos.pPred, pos.pCur, pHead );
- cds::unref(f)( *node_traits::to_value_ptr( *pos.pCur ) );
+ f( *node_traits::to_value_ptr( *pos.pCur ) );
--m_ItemCounter;
nResult = 1;
}
cds::lock::scoped_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
if ( cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
{
- cds::unref(f)( *node_traits::to_value_ptr( *pos.pCur ), val );
+ f( *node_traits::to_value_ptr( *pos.pCur ), val );
return true;
}
}
void dispose_node( node_type * pNode, Disposer disp )
{
clear_links( pNode );
- cds::unref(disp)( node_traits::to_value_ptr( *pNode ));
+ disp( node_traits::to_value_ptr( *pNode ));
}
template <class Disposer>
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You can pass \p func argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p func argument by value or by reference using \p std::ref.
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item.
The function \p find does not serialize simultaneous access to the list \p item. If such access is
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item.
The function \p find does not serialize simultaneous access to the list \p item. If such access is
if ( search( refHead, val, key_comparator(), pos ) ) {
assert( key_comparator()( val, *node_traits::to_value_ptr( *pos.pCur ) ) == 0 );
- unref(func)( false, *node_traits::to_value_ptr( *pos.pCur ) , val );
+ func( false, *node_traits::to_value_ptr( *pos.pCur ) , val );
return std::make_pair( iterator( pos.pCur ), false );
}
else {
if ( link_node( node_traits::to_node_ptr( val ), pos ) ) {
++m_ItemCounter;
- unref(func)( true, val , val );
+ func( true, val , val );
return std::make_pair( iterator( node_traits::to_node_ptr( val )), true );
}
}
if ( search( refHead, val, cmp, pos ) ) {
assert( pos.pCur != nullptr );
- unref(f)( *node_traits::to_value_ptr( *pos.pCur ), val );
+ f( *node_traits::to_value_ptr( *pos.pCur ), val );
return true;
}
return false;
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this list's item by concurrent threads.
The user-defined functor is called only if the inserting is success and may be passed by reference
- using <tt>boost::ref</tt>.
+ using \p std::ref.
The function makes RCU lock internally.
*/
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You can pass \p func argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p func argument by value or by reference using \p std::ref.
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item.
The function \p find does not serialize simultaneous access to the list \p item. If such access is
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item.
The function \p find does not serialize simultaneous access to the list \p item. If such access is
return false;
if ( link_node( node_traits::to_node_ptr( val ), pos ) ) {
- cds::unref(f)( val );
+ f( val );
++m_ItemCounter;
return true;
}
if ( search( refHead, val, pos, key_comparator() ) ) {
assert( key_comparator()( val, *node_traits::to_value_ptr( *pos.pCur ) ) == 0 );
- unref(func)( false, *node_traits::to_value_ptr( *pos.pCur ), val );
+ func( false, *node_traits::to_value_ptr( *pos.pCur ), val );
return std::make_pair( iterator( pos.pCur ), false );
}
else {
if ( link_node( node_traits::to_node_ptr( val ), pos ) ) {
++m_ItemCounter;
- unref(func)( true, val , val );
+ func( true, val , val );
return std::make_pair( iterator( node_traits::to_node_ptr( val )), true );
}
}
}
- cds::unref(f)( *node_traits::to_value_ptr( *pos.pCur ) );
+ f( *node_traits::to_value_ptr( *pos.pCur ) );
--m_ItemCounter;
dispose_node( pos.pCur );
return true;
rcu_lock l( bLock );
if ( search( refHead, val, pos, cmp ) ) {
assert( pos.pCur != nullptr );
- unref(f)( *node_traits::to_value_ptr( *pos.pCur ), val );
+ f( *node_traits::to_value_ptr( *pos.pCur ), val );
return true;
}
return false;
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
The user-defined functor is called only if the inserting is success and can be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref.
*/
template <typename Func>
bool insert( value_type& val, Func f )
The functor may change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You may pass \p func argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p func argument by reference using \p std::ref.
Returns <tt> std::pair<bool, bool> </tt> where \p first is \p true if operation is successfull,
\p second is \p true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
The functor can change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You can pass \p func argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p func argument by value or by reference using \p std::ref.
Returns std::pair<bool, bool> where \p first is \p true if operation is successfull,
\p second is \p true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item.
The functor does not serialize simultaneous access to the set \p item. If such access is
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item.
The functor does not serialize simultaneous access to the set \p item. If such access is
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
The user-defined functor is called only if the inserting is success and can be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref.
*/
template <typename Func>
bool insert( value_type& val, Func f )
The functor can change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You can pass \p func argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p func argument by value or by reference using \p std::ref.
Returns std::pair<bool, bool> where \p first is \p true if operation is successfull,
\p second is \p true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item.
The functor does not serialize simultaneous access to the set \p item. If such access is
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item.
The functor does not serialize simultaneous access to the set \p item. If such access is
#ifndef __CDS_INTRUSIVE_MSPRIORITY_QUEUE_H
#define __CDS_INTRUSIVE_MSPRIORITY_QUEUE_H
+#include <functional> // ref
#include <cds/intrusive/details/base.h>
#include <cds/lock/spinlock.h>
#include <cds/os/thread.h>
#include <cds/opt/buffer.h>
#include <cds/opt/compare.h>
#include <cds/details/bounded_container.h>
-#include <cds/ref.h>
namespace cds { namespace intrusive {
while ( !empty() ) {
value_type * pVal = pop();
if ( pVal )
- cds::unref(f)( *pVal );
+ f( *pVal );
}
}
#define __CDS_INTRUSIVE_OPTIMISTIC_QUEUE_H
#include <type_traits>
+#include <functional> // ref
#include <cds/intrusive/details/base.h>
#include <cds/cxx11_atomic.h>
#include <cds/gc/default_gc.h>
#include <cds/gc/hrc/gc_fwd.h>
#include <cds/intrusive/details/queue_stat.h>
-#include <cds/ref.h>
namespace cds { namespace intrusive {
#include <type_traits>
#include <memory>
+#include <functional> // ref
#include <cds/gc/nogc.h>
#include <cds/intrusive/details/skip_list_base.h>
#include <cds/opt/compare.h>
-#include <cds/ref.h>
#include <cds/details/binary_functor_wrapper.h>
namespace cds { namespace intrusive {
if ( !pos.pPrev[0]->next(0).compare_exchange_strong( p, pNode, memory_model::memory_order_release, memory_model::memory_order_relaxed ) ) {
return false;
}
- cds::unref( f )( val );
+ f( val );
}
for ( unsigned int nLevel = 1; nLevel < nHeight; ++nLevel ) {
if ( find_position( val, pos, cmp, true, false )) {
assert( cmp( *node_traits::to_value_ptr( pos.pCur ), val ) == 0 );
- cds::unref(f)( *node_traits::to_value_ptr( pos.pCur ), val );
+ f( *node_traits::to_value_ptr( pos.pCur ), val );
m_Stat.onFindFastSuccess();
return pos.pCur;
The functor can change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You can pass \p func argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p func argument by value or by reference using \p std::ref.
Returns std::pair<bool, bool> where \p first is \p true if operation is successfull,
\p second is \p true if new item has been added or \p false if the item with \p key
if ( !bTowerMade )
scp.release();
- cds::unref(func)( false, *node_traits::to_value_ptr(pos.pCur), val );
+ func( false, *node_traits::to_value_ptr(pos.pCur), val );
m_Stat.onEnsureExist();
return std::make_pair( true, false );
}
bTowerOk = true;
}
- if ( !insert_at_position( val, pNode, pos, [&func]( value_type& item ) { cds::unref(func)( true, item, item ); })) {
+ if ( !insert_at_position( val, pNode, pos, [&func]( value_type& item ) { func( true, item, item ); })) {
m_Stat.onInsertRetry();
continue;
}
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
#include <type_traits>
#include <memory>
+#include <functional> // ref
#include <cds/intrusive/details/skip_list_base.h>
#include <cds/opt/compare.h>
-#include <cds/ref.h>
#include <cds/urcu/details/check_deadlock.h>
#include <cds/details/binary_functor_wrapper.h>
#include <cds/urcu/exempt_ptr.h>
# ifdef _DEBUG
pNode->m_bLinked = true;
# endif
- cds::unref( f )( val );
+ f( val );
}
for ( unsigned int nLevel = 1; nLevel < nHeight; ++nLevel ) {
int const nMask = bExtract ? 3 : 1;
if ( pDel->next(0).compare_exchange_strong( pSucc, pSucc | nMask, memory_model::memory_order_acquire, atomics::memory_order_relaxed ))
{
- cds::unref(f)( *node_traits::to_value_ptr( pDel ));
+ f( *node_traits::to_value_ptr( pDel ));
// physical deletion
// try fast erase
}
else if ( nCmp == 0 ) {
// found
- cds::unref(f)( *node_traits::to_value_ptr( pCur.ptr() ), val );
+ f( *node_traits::to_value_ptr( pCur.ptr() ), val );
return find_fastpath_found;
}
else // pCur > val - go down
if ( find_position( val, pos, cmp, true )) {
assert( cmp( *node_traits::to_value_ptr( pos.pCur ), val ) == 0 );
- cds::unref(f)( *node_traits::to_value_ptr( pos.pCur ), val );
+ f( *node_traits::to_value_ptr( pos.pCur ), val );
return true;
}
else
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
The user-defined functor is called only if the inserting is success and may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref.
RCU \p synchronize method can be called. RCU should not be locked.
*/
The functor can change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You can pass \p func argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p func argument by value or by reference using \p std::ref.
RCU \p synchronize method can be called. RCU should not be locked.
if ( !bTowerMade )
scp.release();
- cds::unref(func)( false, *node_traits::to_value_ptr(pos.pCur), val );
+ func( false, *node_traits::to_value_ptr(pos.pCur), val );
m_Stat.onEnsureExist();
break;
}
bTowerOk = true;
}
- if ( !insert_at_position( val, pNode, pos, [&func]( value_type& item ) { cds::unref(func)( true, item, item ); })) {
+ if ( !insert_at_position( val, pNode, pos, [&func]( value_type& item ) { func( true, item, item ); })) {
m_Stat.onInsertRetry();
continue;
}
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
assert( pHead != nullptr );
return m_List.find_at( pHead, sv, cmp,
- [&f](value_type& item, split_list::details::search_value_type<Q>& val){ cds::unref(f)(item, val.val ); });
+ [&f](value_type& item, split_list::details::search_value_type<Q>& val){ f(item, val.val ); });
}
template <typename Q, typename Compare>
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
The user-defined functor is called only if the inserting is success and may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref.
*/
template <typename Func>
bool insert( value_type& val, Func f )
The functor can change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You can pass \p func argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p func argument by value or by reference using \p std::ref.
Returns std::pair<bool, bool> where \p first is \p true if operation is successfull,
\p second is \p true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
The functor can change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You can pass \p func argument by value by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p func argument by value by reference using \p std::ref.
Returns std::pair<bool, bool> where \p first is \p true if operation is successfull,
\p second is \p true if new item has been added or \p false if the item with given key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item.
The functor does not serialize simultaneous access to the set \p item. If such access is
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item.
The functor does not serialize simultaneous access to the set \p item. If such access is
dummy_node_type * pHead = get_bucket( nHash );
assert( pHead != nullptr );
return m_List.find_at( pHead, sv, cmp,
- [&f](value_type& item, split_list::details::search_value_type<Q>& val){ cds::unref(f)(item, val.val ); });
+ [&f](value_type& item, split_list::details::search_value_type<Q>& val){ f(item, val.val ); });
}
//@endcond
assert( pHead != nullptr );
return m_List.find_at( pHead, sv, cmp,
- [&f](value_type& item, split_list::details::search_value_type<Q>& val){ cds::unref(f)(item, val.val ); });
+ [&f](value_type& item, split_list::details::search_value_type<Q>& val){ f(item, val.val ); });
}
template <typename Q, typename Compare>
where \p val is the item inserted. User-defined functor \p f should guarantee that during changing
\p val no any other changes could be made on this set's item by concurrent threads.
The user-defined functor is called only if the inserting is success and may be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref.
The function makes RCU lock internally.
*/
The functor can change non-key fields of the \p item; however, \p func must guarantee
that during changing no any other modifications could be made on this item by concurrent threads.
- You can pass \p func argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p func argument by value or by reference using \p std::ref.
The function makes RCU lock internally.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by value or by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by value or by reference using \p std::ref.
The functor can change non-key fields of \p item. Note that the functor is only guarantee
that \p item cannot be disposed during functor is executing.
where \p val is the item inserted.
The user-defined functor is called only if the inserting is success and can be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref.
*/
template <typename Func>
bool insert( value_type& val, Func f )
The functor may change non-key fields of the \p item.
- You may pass \p func argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You may pass \p func argument by reference using \p std::ref.
Returns <tt> std::pair<bool, bool> </tt> where \p first is \p true if operation is successful,
\p second is \p true if new item has been added or \p false if the item with \p key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item.
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by reference using \p std::ref.
The functor may change non-key fields of \p item.
#ifndef __CDS_INTRUSIVE_STRIPED_SET_ADAPTER_H
#define __CDS_INTRUSIVE_STRIPED_SET_ADAPTER_H
+#include <functional> // ref
#include <cds/opt/options.h>
#include <cds/intrusive/striped_set/resizing_policy.h>
#include <cds/opt/hash.h>
#include <cds/opt/compare.h> // cds::opt::details::make_comparator - for some adapt specializations
-#include <cds/ref.h>
namespace cds { namespace intrusive {
where \p item is the item inserted.
The user-defined functor \p f is called only if the inserting is success. It can be passed by reference
- using <tt>boost::ref</tt>
+ using \p std::ref
<hr>
<b>Ensures that the \p item exists in the container</b>
The functor can change non-key fields of the \p item.
- You can pass \p f argument by reference using <tt>boost::ref</tt>.
+ You can pass \p f argument by reference using \p std::ref
Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
\p second is true if new item has been added or \p false if the item with \p val key
\endcode
where \p item is the item found, \p val is the <tt>find</tt> function argument.
- You can pass \p f argument by reference using <tt>boost::ref</tt> or cds::ref.
+ You can pass \p f argument by reference using \p std::ref.
The functor can change non-key fields of \p item.
The \p val argument may be non-const since it can be used as \p f functor destination i.e., the functor
{
std::pair<iterator, bool> res = m_Set.insert( val );
if ( res.second )
- cds::unref(f)( val );
+ f( val );
return res.second;
}
std::pair<bool, bool> ensure( value_type& val, Func f )
{
std::pair<iterator, bool> res = m_Set.insert( val );
- cds::unref(f)( res.second, *res.first, val );
+ f( res.second, *res.first, val );
return std::make_pair( true, res.second );
}
if (it == m_Set.end())
return nullptr;
value_type& val = *it;
- cds::unref(f)( val );
+ f( val );
m_Set.erase( it );
return &val;
}
if (it == m_Set.end())
return nullptr;
value_type& val = *it;
- cds::unref(f)( val );
+ f( val );
m_Set.erase( it );
return &val;
}
iterator it = m_Set.find( key, cmp );
if ( it == m_Set.end() )
return false;
- cds::unref(f)( *it, key );
+ f( *it, key );
return true;
}
iterator it = find_key( val, find_predicate() );
if ( it == m_List.end() || key_comparator()( val, *it ) != 0 ) {
m_List.insert( it, val );
- cds::unref( f )( val );
+ f( val );
return true;
}
if ( it == m_List.end() || key_comparator()( val, *it ) != 0 ) {
// insert new
m_List.insert( it, val );
- cds::unref( f )( true, val, val );
+ f( true, val, val );
return std::make_pair( true, true );
}
else {
// already exists
- cds::unref( f )( false, *it, val );
+ f( false, *it, val );
return std::make_pair( true, false );
}
}
// key exists
value_type& val = *it;
- cds::unref( f )( val );
+ f( val );
m_List.erase( it );
return &val;
// key exists
value_type& val = *it;
- cds::unref( f )( val );
+ f( val );
m_List.erase( it );
return &val;
return false;
// key exists
- cds::unref( f )( *it, key );
+ f( *it, key );
return true;
}
// key exists
iterator it = pos.first;
value_type& val = *(++it);
- cds::unref( f )( val );
+ f( val );
m_List.erase_after( pos.first );
return &val;
std::pair< iterator, bool > pos = find_prev_item( val );
if ( !pos.second ) {
m_List.insert_after( pos.first, val );
- cds::unref( f )( val );
+ f( val );
return true;
}
if ( !pos.second ) {
// insert new
m_List.insert_after( pos.first, val );
- cds::unref( f )( true, val, val );
+ f( true, val, val );
return std::make_pair( true, true );
}
else {
// already exists
- cds::unref( f )( false, *(++pos.first), val );
+ f( false, *(++pos.first), val );
return std::make_pair( true, false );
}
}
return false;
// key exists
- cds::unref( f )( *(++pos.first), key );
+ f( *(++pos.first), key );
return true;
}
return false;
// key exists
- cds::unref( f )( *(++pos.first), key );
+ f( *(++pos.first), key );
return true;
}
{
std::pair<iterator, bool> res = m_Set.insert( val );
if ( res.second )
- cds::unref(f)( val );
+ f( val );
return res.second;
}
std::pair<bool, bool> ensure( value_type& val, Func f )
{
std::pair<iterator, bool> res = m_Set.insert( val );
- cds::unref(f)( res.second, *res.first, val );
+ f( res.second, *res.first, val );
return std::make_pair( true, res.second );
}
if ( it == m_Set.end() )
return nullptr;
value_type& val = *it;
- cds::unref(f)( val );
+ f( val );
m_Set.erase( it );
return &val;
}
if ( it == m_Set.end() )
return nullptr;
value_type& val = *it;
- cds::unref(f)( val );
+ f( val );
m_Set.erase( it );
return &val;
}
iterator it = m_Set.find( key, typename container_type::hasher(), typename container_type::key_equal() );
if ( it == m_Set.end() )
return false;
- cds::unref(f)( *it, key );
+ f( *it, key );
return true;
}
iterator it = m_Set.find( key, typename container_type::hasher(), equal_from_compare<Less>(pred) );
if ( it == m_Set.end() )
return false;
- cds::unref(f)( *it, key );
+ f( *it, key );
return true;
}
#define __CDS_INTRUSIVE_TREIBER_STACK_H
#include <type_traits>
+#include <functional> // ref
#include <cds/intrusive/details/single_link_struct.h>
-#include <cds/ref.h>
#include <cds/algo/elimination.h>
#include <cds/opt/buffer.h>
#include <cds/lock/spinlock.h>
#ifndef __CDS_INTRUSIVE_TSIGAS_CYCLE_QUEUE_H
#define __CDS_INTRUSIVE_TSIGAS_CYCLE_QUEUE_H
+#include <functional> // ref
#include <cds/intrusive/details/base.h>
#include <cds/cxx11_atomic.h>
#include <cds/details/bounded_container.h>
#include <cds/opt/buffer.h>
-#include <cds/ref.h>
namespace cds { namespace intrusive {
void operator ()( T * val );
};
\endcode
- You can pass \p disposer by reference using \p boost::ref.
+ You can pass \p disposer by reference using \p std::ref.
The disposer will be called immediately for each item.
*/
template <typename Disposer>
{
value_type * pv;
while ( (pv = pop()) != nullptr ) {
- unref(f)( pv );
+ f( pv );
}
}
void operator ()( T * val );
};
\endcode
- You can pass \p disposer by reference using \p boost::ref.
+ You can pass \p disposer by reference using \p std::ref.
The disposer will be called immediately for each item.
*/
template <typename Disposer>
{
value_type * pv;
while ( (pv = pop()) != nullptr ) {
- unref(f)( pv );
+ f( pv );
}
}
+++ /dev/null
-//$$CDS-header$$
-
-#ifndef __CDS_REF_H
-#define __CDS_REF_H
-
-#include <cds/details/defs.h>
-#include <boost/ref.hpp>
-
-//@cond
-namespace cds {
-
- using boost::ref;
-
- namespace details {
- template <typename T>
- struct unwrap_reference
- {
- typedef T type;
- static T apply(T f)
- {
- return f;
- }
- };
-
- template <typename T>
- struct unwrap_reference<T&>
- {
- typedef T& type;
- static T& apply( T& f )
- {
- return f;
- }
- };
-
- template <typename T>
- struct unwrap_reference<boost::reference_wrapper<T> >
- {
- typedef T& type;
- static T& apply( boost::reference_wrapper<T> f )
- {
- return f.get();
- }
- };
- }
-
- template <typename T>
- static inline typename details::unwrap_reference<T>::type unref( T f )
- {
- return cds::details::unwrap_reference<T>::apply(f);
- }
-}
-//@endcond
-
-#endif // #ifndef __CDS_REF_H
#include "cppunit/cppunit_proxy.h"
#include <cds/os/timer.h>
#include <cds/opt/hash.h>
-#include <cds/ref.h>
+#include <functional> // ref
#include <algorithm> // random_shuffle
namespace cds { namespace container {}}
// find test
check_value chk(10);
- CPPUNIT_ASSERT( m.find( 10, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 10, std::ref(chk) ));
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find_with( 25, predicate(), boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find_with( 25, predicate(), std::ref(chk) ));
chk.m_nExpected = 90;
- CPPUNIT_ASSERT( m.find( 30, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 30, std::ref(chk) ));
chk.m_nExpected = 54;
- CPPUNIT_ASSERT( m.find( 27, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 27, std::ref(chk) ));
ensureResult = m.ensure( 10, insert_functor<Map>() ) ; // value = 50
CPPUNIT_ASSERT( ensureResult.first );
CPPUNIT_ASSERT( !ensureResult.second );
chk.m_nExpected = 50;
- CPPUNIT_ASSERT( m.find( 10, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 10, std::ref(chk) ));
// erase test
CPPUNIT_ASSERT( !m.find(100) );
CPPUNIT_ASSERT( !m.find(29) );
CPPUNIT_ASSERT( m.insert(29, 290))
- CPPUNIT_ASSERT( m.erase_with( 29, predicate(), boost::ref(ext)));
+ CPPUNIT_ASSERT( m.erase_with( 29, predicate(), std::ref(ext)));
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 3 ));
CPPUNIT_ASSERT( nVal == 290 );
nVal = -1;
- CPPUNIT_ASSERT( !m.erase_with( 29, predicate(), boost::ref(ext)));
+ CPPUNIT_ASSERT( !m.erase_with( 29, predicate(), std::ref( ext ) ) );
CPPUNIT_ASSERT( nVal == -1 );
- CPPUNIT_ASSERT( m.erase( 30, boost::ref(ext)));
+ CPPUNIT_ASSERT( m.erase( 30, std::ref( ext ) ) );
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 2 ));
CPPUNIT_ASSERT( nVal == 90 );
nVal = -1;
- CPPUNIT_ASSERT( !m.erase( 30, boost::ref(ext)));
+ CPPUNIT_ASSERT( !m.erase( 30, std::ref( ext ) ) );
CPPUNIT_ASSERT( nVal == -1 );
m.clear();
CPPUNIT_ASSERT( check_size( m, 3 ));
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find( 126, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 126, std::ref(chk) ));
chk.m_nExpected = 731;
- CPPUNIT_ASSERT( m.find_with( 137, predicate(), cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find_with( 137, predicate(), std::ref(chk) ));
chk.m_nExpected = 941;
- CPPUNIT_ASSERT( m.find( 149, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 149, std::ref(chk) ));
CPPUNIT_ASSERT( !m.emplace(126, 621)) ; // already in map
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find( 126, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 126, std::ref(chk) ));
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 3 ));
#include "cppunit/cppunit_proxy.h"
#include <cds/os/timer.h>
#include <cds/opt/hash.h>
-#include <cds/ref.h>
+#include <functional> // ref
#include <algorithm> // random_shuffle
namespace cds { namespace container {}}
// find test
check_value chk(10);
- CPPUNIT_ASSERT( m.find( 10, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 10, std::ref(chk) ));
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find_with( 25, less(), boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find_with( 25, less(), std::ref( chk ) ) );
chk.m_nExpected = 90;
- CPPUNIT_ASSERT( m.find( 30, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 30, std::ref( chk ) ) );
chk.m_nExpected = 54;
- CPPUNIT_ASSERT( m.find( 27, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 27, std::ref( chk ) ) );
ensureResult = m.ensure( 10, insert_functor<Map>() ) ; // value = 50
CPPUNIT_ASSERT( ensureResult.first );
CPPUNIT_ASSERT( !ensureResult.second );
chk.m_nExpected = 50;
- CPPUNIT_ASSERT( m.find( 10, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 10, std::ref( chk ) ) );
// erase test
CPPUNIT_ASSERT( !m.find(100) );
CPPUNIT_ASSERT( !m.find(29) );
CPPUNIT_ASSERT( m.insert(29, 290));
CPPUNIT_ASSERT( check_size( m, 4 ));
- CPPUNIT_ASSERT( m.erase_with( 29, less(), boost::ref(ext)));
+ CPPUNIT_ASSERT( m.erase_with( 29, less(), std::ref( ext ) ) );
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 3 ));
CPPUNIT_ASSERT( nVal == 290 );
nVal = -1;
- CPPUNIT_ASSERT( !m.erase_with( 29, less(), boost::ref(ext)));
+ CPPUNIT_ASSERT( !m.erase_with( 29, less(), std::ref( ext ) ) );
CPPUNIT_ASSERT( nVal == -1 );
- CPPUNIT_ASSERT( m.erase( 30, boost::ref(ext)));
+ CPPUNIT_ASSERT( m.erase( 30, std::ref( ext ) ) );
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 2 ));
CPPUNIT_ASSERT( nVal == 90 );
nVal = -1;
- CPPUNIT_ASSERT( !m.erase( 30, boost::ref(ext)));
+ CPPUNIT_ASSERT( !m.erase( 30, std::ref( ext ) ) );
CPPUNIT_ASSERT( nVal == -1 );
m.clear();
CPPUNIT_ASSERT( check_size( m, 3 ));
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find( 126, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 126, std::ref(chk) ));
chk.m_nExpected = 731;
- CPPUNIT_ASSERT( m.find_with( 137, less(), cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find_with( 137, less(), std::ref(chk) ));
chk.m_nExpected = 941;
- CPPUNIT_ASSERT( m.find( 149, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 149, std::ref(chk) ));
CPPUNIT_ASSERT( !m.emplace(126, 621)) ; // already in map
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find( 126, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 126, std::ref(chk) ));
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 3 ));
#include "cppunit/cppunit_proxy.h"
#include <cds/os/timer.h>
#include <cds/opt/hash.h>
-#include <cds/ref.h>
+#include <functional> // ref
#include <algorithm> // random_shuffle
namespace cds { namespace container {}}
// find test
check_value chk(10);
- CPPUNIT_ASSERT( m.find( 10, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 10, std::ref(chk) ));
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find( 25, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 25, std::ref( chk ) ) );
chk.m_nExpected = 90;
- CPPUNIT_ASSERT( m.find( 30, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 30, std::ref( chk ) ) );
chk.m_nExpected = 54;
- CPPUNIT_ASSERT( m.find( 27, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 27, std::ref( chk ) ) );
ensureResult = m.ensure( 10, insert_functor<Map>() ) ; // value = 50
CPPUNIT_ASSERT( ensureResult.first );
CPPUNIT_ASSERT( !ensureResult.second );
chk.m_nExpected = 50;
- CPPUNIT_ASSERT( m.find( 10, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 10, std::ref( chk ) ) );
// erase test
CPPUNIT_ASSERT( !m.find(100) );
CPPUNIT_ASSERT( !m.find(29) );
CPPUNIT_ASSERT( m.insert(29, 290));
CPPUNIT_ASSERT( check_size( m, 4 ));
- CPPUNIT_ASSERT( m.erase( 29, boost::ref(ext)));
+ CPPUNIT_ASSERT( m.erase( 29, std::ref( ext ) ) );
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 3 ));
CPPUNIT_ASSERT( nVal == 290 );
nVal = -1;
- CPPUNIT_ASSERT( !m.erase( 29, boost::ref(ext)));
+ CPPUNIT_ASSERT( !m.erase( 29, std::ref( ext ) ) );
CPPUNIT_ASSERT( nVal == -1 );
- CPPUNIT_ASSERT( m.erase( 30, boost::ref(ext)));
+ CPPUNIT_ASSERT( m.erase( 30, std::ref( ext ) ) );
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 2 ));
CPPUNIT_ASSERT( nVal == 90 );
nVal = -1;
- CPPUNIT_ASSERT( !m.erase( 30, boost::ref(ext)));
+ CPPUNIT_ASSERT( !m.erase( 30, std::ref( ext ) ) );
CPPUNIT_ASSERT( nVal == -1 );
m.clear();
CPPUNIT_ASSERT( check_size( m, 3 ));
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find( 126, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 126, std::ref(chk) ));
chk.m_nExpected = 731;
- CPPUNIT_ASSERT( m.find( 137, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 137, std::ref(chk) ));
chk.m_nExpected = 941;
- CPPUNIT_ASSERT( m.find( 149, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 149, std::ref(chk) ));
CPPUNIT_ASSERT( !m.emplace(126, 621)) ; // already in map
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find( 126, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 126, std::ref(chk) ));
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 3 ));
// find test
check_value chk(10);
- CPPUNIT_ASSERT( m.find( 10, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 10, std::ref(chk) ));
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find_with( 25, less(), boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find_with( 25, less(), std::ref( chk ) ) );
chk.m_nExpected = 90;
- CPPUNIT_ASSERT( m.find( 30, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 30, std::ref( chk ) ) );
chk.m_nExpected = 54;
- CPPUNIT_ASSERT( m.find( 27, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 27, std::ref( chk ) ) );
ensureResult = m.ensure( 10, insert_functor<Map>() ) ; // value = 50
CPPUNIT_ASSERT( ensureResult.first );
CPPUNIT_ASSERT( !ensureResult.second );
chk.m_nExpected = 50;
- CPPUNIT_ASSERT( m.find( 10, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 10, std::ref( chk ) ) );
// erase test
CPPUNIT_ASSERT( !m.find(100) );
CPPUNIT_ASSERT( !m.find(29) );
CPPUNIT_ASSERT( m.insert(29, 290))
- CPPUNIT_ASSERT( m.erase_with( 29, less(), boost::ref(ext)));
+ CPPUNIT_ASSERT( m.erase_with( 29, less(), std::ref( ext ) ) );
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 3 ));
CPPUNIT_ASSERT( nVal == 290 );
nVal = -1;
- CPPUNIT_ASSERT( !m.erase_with( 29, less(), boost::ref(ext)));
+ CPPUNIT_ASSERT( !m.erase_with( 29, less(), std::ref( ext ) ) );
CPPUNIT_ASSERT( nVal == -1 );
- CPPUNIT_ASSERT( m.erase( 30, boost::ref(ext)));
+ CPPUNIT_ASSERT( m.erase( 30, std::ref( ext ) ) );
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 2 ));
CPPUNIT_ASSERT( nVal == 90 );
nVal = -1;
- CPPUNIT_ASSERT( !m.erase( 30, boost::ref(ext)));
+ CPPUNIT_ASSERT( !m.erase( 30, std::ref( ext ) ) );
CPPUNIT_ASSERT( nVal == -1 );
m.clear();
CPPUNIT_ASSERT( check_size( m, 3 ));
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find( 126, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 126, std::ref(chk) ));
chk.m_nExpected = 731;
- CPPUNIT_ASSERT( m.find_with( 137, less(), cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find_with( 137, less(), std::ref(chk) ));
chk.m_nExpected = 941;
- CPPUNIT_ASSERT( m.find( 149, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 149, std::ref(chk) ));
CPPUNIT_ASSERT( !m.emplace(126, 621)) ; // already in map
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find( 126, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 126, std::ref(chk) ));
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 3 ));
// passed by ref
{
insert_functor f;
- CPPUNIT_ASSERT( l.insert( item(25), boost::ref(f)) );
- CPPUNIT_ASSERT( !l.insert( item(100), boost::ref(f)) );
+ CPPUNIT_ASSERT( l.insert( item( 25 ), std::ref( f ) ) );
+ CPPUNIT_ASSERT( !l.insert( item( 100 ), std::ref( f ) ) );
}
// Test insert with function
CPPUNIT_ASSERT( l.insert( 50, insert_function ));
check_value f(1033);
i = 25;
CPPUNIT_ASSERT( l.find_with( 25, lt<value_type>() ));
- CPPUNIT_ASSERT( l.find_with( i, lt<value_type>(), boost::ref(f) ));
+ CPPUNIT_ASSERT( l.find_with( i, lt<value_type>(), std::ref( f ) ) );
}
i = 50;
CPPUNIT_ASSERT( l.find( 50 ));
CPPUNIT_ASSERT( ensureResult.first );
CPPUNIT_ASSERT( ensureResult.second );
- ensureResult = l.ensure( 200, boost::ref(f) );
+ ensureResult = l.ensure( 200, std::ref( f ) );
CPPUNIT_ASSERT( ensureResult.first );
CPPUNIT_ASSERT( ensureResult.second );
{
erase_functor ef;
CPPUNIT_ASSERT( ef.nEraseCall == 0 );
- CPPUNIT_ASSERT( l.erase_with( 160, lt<value_type>(), cds::ref(ef) ));
+ CPPUNIT_ASSERT( l.erase_with( 160, lt<value_type>(), std::ref(ef) ));
CPPUNIT_ASSERT( ef.nEraseCall == 1 );
- CPPUNIT_ASSERT( !l.erase_with( 160, lt<value_type>(), cds::ref(ef) ));
+ CPPUNIT_ASSERT( !l.erase_with( 160, lt<value_type>(), std::ref(ef) ));
CPPUNIT_ASSERT( ef.nEraseCall == 1 );
- CPPUNIT_ASSERT( l.erase( 250, cds::ref(ef) ));
+ CPPUNIT_ASSERT( l.erase( 250, std::ref(ef) ));
CPPUNIT_ASSERT( ef.nEraseCall == 2 );
- CPPUNIT_ASSERT( !l.erase( 250, cds::ref(ef) ));
+ CPPUNIT_ASSERT( !l.erase( 250, std::ref(ef) ));
CPPUNIT_ASSERT( ef.nEraseCall == 2 );
}
CPPUNIT_ASSERT( l.find( 100 ));
check_value chk(0);
- CPPUNIT_ASSERT( l.find( 100, boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) );
CPPUNIT_ASSERT( !l.find_with( 50, lt<key_type>() ));
CPPUNIT_ASSERT( l.insert( 50, 500 ));
CPPUNIT_ASSERT( l.find_with( 50, lt<key_type>() ));
CPPUNIT_ASSERT( !l.insert( 50, 5 ));
chk.m_nExpected = 500;
- CPPUNIT_ASSERT( l.find( 50, boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) );
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( l.find( 100, boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) );
CPPUNIT_ASSERT( !l.empty() );
CPPUNIT_ASSERT( !l.find( 150 ));
CPPUNIT_ASSERT( l.insert_key( 150, insert_functor() ));
CPPUNIT_ASSERT( l.find( 150 ));
chk.m_nExpected = 1500;
- CPPUNIT_ASSERT( l.find_with( 150, lt<key_type>(), boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find_with( 150, lt<key_type>(), std::ref( chk ) ) );
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( l.find( 100, boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) );
chk.m_nExpected = 500;
- CPPUNIT_ASSERT( l.find( 50, boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) );
CPPUNIT_ASSERT( !l.empty() );
// erase test
CPPUNIT_ASSERT( l.find( 50 ));
{
erase_functor ef;
- l.erase( 50, boost::ref(ef));
+ l.erase( 50, std::ref( ef ) );
CPPUNIT_ASSERT( ef.nKey == 50 );
CPPUNIT_ASSERT( ef.nVal == 500 );
}
CPPUNIT_ASSERT( bEnsureResult.first );
CPPUNIT_ASSERT( !bEnsureResult.second );
chk.m_nExpected = 5000;
- CPPUNIT_ASSERT( l.find( 100, boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) );
{
ensure_functor ef;
- bEnsureResult = l.ensure( 50, boost::ref( ef ));
+ bEnsureResult = l.ensure( 50, std::ref( ef ) );
}
CPPUNIT_ASSERT( bEnsureResult.first );
CPPUNIT_ASSERT( bEnsureResult.second );
chk.m_nExpected = 2500;
- CPPUNIT_ASSERT( l.find( 50, boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) );
// erase test
CPPUNIT_ASSERT( !l.empty() );
CPPUNIT_ASSERT( l.erase( 150 ));
{
erase_functor ef;
- CPPUNIT_ASSERT( l.erase_with( 200, lt<key_type>(), cds::ref(ef)) );
+ CPPUNIT_ASSERT( l.erase_with( 200, lt<key_type>(), std::ref(ef)) );
CPPUNIT_ASSERT( ef.nKey == 200 );
CPPUNIT_ASSERT( ef.nVal == 2000 );
}
CPPUNIT_ASSERT( !l.emplace( 251, 10) );
check_value cv(0);
- CPPUNIT_ASSERT( l.find( 501, cds::ref(cv) ));
+ CPPUNIT_ASSERT( l.find( 501, std::ref(cv) ));
cv.m_nExpected = 152;
- CPPUNIT_ASSERT( l.find( 251, cds::ref(cv) ));
+ CPPUNIT_ASSERT( l.find( 251, std::ref(cv) ));
l.clear();
CPPUNIT_ASSERT( l.empty() );
// Check that we have visited all items
for ( int i = 0; i < nCount; ++i ) {
chk.m_nExpected = i * 3;
- CPPUNIT_ASSERT( l.find( i, boost::ref(chk) ));
+ CPPUNIT_ASSERT( l.find( i, std::ref( chk ) ) );
}
l.clear();
// Check that we have visited all items
for ( int i = nCount; i > 0; --i ) {
chk.m_nExpected = (i - 1) * 7;
- CPPUNIT_ASSERT( l.find_with( i - 1, lt<key_type>(), boost::ref(chk) ));
+ CPPUNIT_ASSERT( l.find_with( i - 1, lt<key_type>(), std::ref( chk ) ) );
}
l.clear();
// passed by ref
{
insert_functor f;
- CPPUNIT_ASSERT( l.insert( item(25), boost::ref(f)) );
- CPPUNIT_ASSERT( !l.insert( item(100), boost::ref(f)) );
+ CPPUNIT_ASSERT( l.insert( item( 25 ), std::ref( f ) ) );
+ CPPUNIT_ASSERT( !l.insert( item( 100 ), std::ref( f ) ) );
}
// Test insert with function
CPPUNIT_ASSERT( l.insert( 50, insert_function ));
check_value f(1033);
i = 25;
CPPUNIT_ASSERT( l.find_with( 25, lt<value_type>() ));
- CPPUNIT_ASSERT( l.find_with( i, lt<value_type>(), boost::ref(f) ));
+ CPPUNIT_ASSERT( l.find_with( i, lt<value_type>(), std::ref( f ) ) );
}
i = 50;
CPPUNIT_ASSERT( l.find( 50 ));
CPPUNIT_ASSERT( ensureResult.first );
CPPUNIT_ASSERT( ensureResult.second );
- ensureResult = l.ensure( 200, boost::ref(f) );
+ ensureResult = l.ensure( 200, std::ref( f ) );
CPPUNIT_ASSERT( ensureResult.first );
CPPUNIT_ASSERT( ensureResult.second );
{
erase_functor ef;
CPPUNIT_ASSERT( ef.nEraseCall == 0 );
- CPPUNIT_ASSERT( l.erase_with( 160, lt<value_type>(), cds::ref(ef) ));
+ CPPUNIT_ASSERT( l.erase_with( 160, lt<value_type>(), std::ref(ef) ));
CPPUNIT_ASSERT( ef.nEraseCall == 1 );
- CPPUNIT_ASSERT( !l.erase_with( 160, lt<value_type>(), cds::ref(ef) ));
+ CPPUNIT_ASSERT( !l.erase_with( 160, lt<value_type>(), std::ref(ef) ));
CPPUNIT_ASSERT( ef.nEraseCall == 1 );
- CPPUNIT_ASSERT( l.erase( 250, cds::ref(ef) ));
+ CPPUNIT_ASSERT( l.erase( 250, std::ref(ef) ));
CPPUNIT_ASSERT( ef.nEraseCall == 2 );
- CPPUNIT_ASSERT( !l.erase( 250, cds::ref(ef) ));
+ CPPUNIT_ASSERT( !l.erase( 250, std::ref(ef) ));
CPPUNIT_ASSERT( ef.nEraseCall == 2 );
}
CPPUNIT_ASSERT( l.find( 100 ));
check_value chk(0);
- CPPUNIT_ASSERT( l.find( 100, boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) );
CPPUNIT_ASSERT( !l.find_with( 50, lt<key_type>() ));
CPPUNIT_ASSERT( l.insert( 50, 500 ));
CPPUNIT_ASSERT( l.find_with( 50, lt<key_type>() ));
CPPUNIT_ASSERT( !l.insert( 50, 5 ));
chk.m_nExpected = 500;
- CPPUNIT_ASSERT( l.find_with( 50, lt<key_type>(), boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find_with( 50, lt<key_type>(), std::ref( chk ) ) );
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( l.find_with( 100, lt<key_type>(), boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find_with( 100, lt<key_type>(), std::ref( chk ) ) );
CPPUNIT_ASSERT( !l.empty() );
CPPUNIT_ASSERT( !l.find( 150 ));
CPPUNIT_ASSERT( l.insert_key( 150, insert_functor() ));
CPPUNIT_ASSERT( l.find( 150 ));
chk.m_nExpected = 1500;
- CPPUNIT_ASSERT( l.find( 150, boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find( 150, std::ref( chk ) ) );
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( l.find( 100, boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) );
chk.m_nExpected = 500;
- CPPUNIT_ASSERT( l.find( 50, boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) );
CPPUNIT_ASSERT( !l.empty() );
// erase test
CPPUNIT_ASSERT( l.find( 50 ));
{
erase_functor ef;
- l.erase( 50, boost::ref(ef));
+ l.erase( 50, std::ref( ef ) );
CPPUNIT_ASSERT( ef.nKey == 50 );
CPPUNIT_ASSERT( ef.nVal == 500 );
}
CPPUNIT_ASSERT( bEnsureResult.first );
CPPUNIT_ASSERT( !bEnsureResult.second );
chk.m_nExpected = 5000;
- CPPUNIT_ASSERT( l.find( 100, boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find( 100, std::ref( chk ) ) );
{
ensure_functor ef;
- bEnsureResult = l.ensure( 50, boost::ref( ef ));
+ bEnsureResult = l.ensure( 50, std::ref( ef ) );
}
CPPUNIT_ASSERT( bEnsureResult.first );
CPPUNIT_ASSERT( bEnsureResult.second );
chk.m_nExpected = 2500;
- CPPUNIT_ASSERT( l.find( 50, boost::ref( chk ) ));
+ CPPUNIT_ASSERT( l.find( 50, std::ref( chk ) ) );
// erase test
CPPUNIT_ASSERT( !l.empty() );
CPPUNIT_ASSERT( l.erase( 150 ));
{
erase_functor ef;
- CPPUNIT_ASSERT( l.erase_with( 200, lt<key_type>(), cds::ref(ef)) );
+ CPPUNIT_ASSERT( l.erase_with( 200, lt<key_type>(), std::ref(ef)) );
CPPUNIT_ASSERT( ef.nKey == 200 );
CPPUNIT_ASSERT( ef.nVal == 2000 );
}
CPPUNIT_ASSERT( !l.emplace( 251, 10) );
check_value cv(0);
- CPPUNIT_ASSERT( l.find( 501, cds::ref(cv) ));
+ CPPUNIT_ASSERT( l.find( 501, std::ref(cv) ));
cv.m_nExpected = 152;
- CPPUNIT_ASSERT( l.find( 251, cds::ref(cv) ));
+ CPPUNIT_ASSERT( l.find( 251, std::ref(cv) ));
l.clear();
CPPUNIT_ASSERT( l.empty() );
// Check that we have visited all items
for ( int i = 0; i < nCount; ++i ) {
chk.m_nExpected = i * 3;
- CPPUNIT_ASSERT( l.find( i, boost::ref(chk) ));
+ CPPUNIT_ASSERT( l.find( i, std::ref( chk ) ) );
}
l.clear();
// Check that we have visited all items
for ( int i = 0; i < nCount; ++i ) {
chk.m_nExpected = i * 7;
- CPPUNIT_ASSERT( l.find_with( i, lt<key_type>(), boost::ref(chk) ));
+ CPPUNIT_ASSERT( l.find_with( i, lt<key_type>(), std::ref( chk ) ) );
}
l.clear();
#include "cppunit/cppunit_proxy.h"
#include "size_check.h"
#include <algorithm>
-#include <cds/ref.h>
+#include <functional> // ref
namespace priority_queue {
{
intrusive_pqueue::another_disposer disp;
- pq.clear_with( cds::ref(disp) );
+ pq.clear_with( std::ref(disp) );
CPPUNIT_ASSERT( pq.empty() );
CPPUNIT_ASSERT( !pq.full() );
CPPUNIT_ASSERT( pq.size() == 0 );
#include "cppunit/cppunit_proxy.h"
#include "size_check.h"
#include <algorithm>
-#include <cds/ref.h>
+#include <functional> // ref
namespace priority_queue {
{
pqueue::disposer disp;
- pq.clear_with( cds::ref(disp) );
+ pq.clear_with( std::ref(disp) );
CPPUNIT_ASSERT( pq.empty() );
CPPUNIT_ASSERT( !pq.full() );
CPPUNIT_ASSERT( pq.size() == 0 );
#include "cppunit/cppunit_proxy.h"
#include <cds/intrusive/details/base.h>
-#include <cds/ref.h>
+#include <functional> // ref
#include "size_check.h"
namespace queue {
nCount = 0;
while ( !q.empty() ) {
if ( nCount & 1 ) {
- CPPUNIT_ASSERT( q.pop( v, cds::ref(pf) ));
+ CPPUNIT_ASSERT( q.pop( v, std::ref(pf) ));
}
else {
- CPPUNIT_ASSERT( q.dequeue( v, cds::ref(pf) ));
+ CPPUNIT_ASSERT( q.dequeue( v, std::ref(pf) ));
}
// It is possible c_nItemCount % quasi_factor() != 0
#include <cds/opt/hash.h>
#include <cds/os/timer.h>
-#include <cds/ref.h>
+#include <functional> // ref
#include <algorithm> // random_shuffle
// forward namespace declaration
{
copy_found<item> f;
key = 20;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( f.m_found.nFindCount == 1 );
{
copy_found<item> f;
key = 20;
- CPPUNIT_ASSERT( s.find_with( key, pred, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find_with( key, pred, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( f.m_found.nFindCount == 1 );
{
copy_found<item> f;
key = 25;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 25 );
CPPUNIT_ASSERT( f.m_found.nVal == 2500 );
}
key = 10;
{
copy_found<item> f;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 10 );
CPPUNIT_ASSERT( f.m_found.nVal == 10 );
CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
CPPUNIT_ASSERT( check_size( s, 3 ));
{
copy_found<item> f;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 10 );
CPPUNIT_ASSERT( f.m_found.nVal == 10 );
CPPUNIT_ASSERT( f.m_found.nEnsureCount == 1 );
{
copy_found<item> f;
key = 13;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 13 );
CPPUNIT_ASSERT( f.m_found.nVal == 1300 );
CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
CPPUNIT_ASSERT( s.find(20) );
{
copy_found<item> f;
- CPPUNIT_ASSERT( s.erase( 20, boost::ref(f) ));
+ CPPUNIT_ASSERT( s.erase( 20, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( s.insert(235))
- CPPUNIT_ASSERT( s.erase_with( 235, pred, boost::ref(f) ));
+ CPPUNIT_ASSERT( s.erase_with( 235, pred, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 235 );
CPPUNIT_ASSERT( f.m_found.nVal == 235 );
}
{
copy_found<item> f;
key = 151;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 151 );
CPPUNIT_ASSERT( f.m_found.nVal == 151 );
key = 174;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 174 );
CPPUNIT_ASSERT( f.m_found.nVal == 471 );
key = 190;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 190 );
CPPUNIT_ASSERT( f.m_found.nVal == 91 );
}
#include "size_check.h"
#include <cds/opt/hash.h>
-#include <cds/ref.h>
+#include <functional> // ref
#include <algorithm> // random_shuffle
// forward declaration
find_functor ff;
CPPUNIT_ASSERT( !s.find( v3 ));
CPPUNIT_ASSERT( v3.nVal != v3.nKey * 100 );
- CPPUNIT_ASSERT( s.insert( v3, cds::ref(fi) ));
+ CPPUNIT_ASSERT( s.insert( v3, std::ref(fi) ));
CPPUNIT_ASSERT( v3.nVal == v3.nKey * 100 );
CPPUNIT_ASSERT( v3.nFindCount == 0 );
- CPPUNIT_ASSERT( s.find( v3, cds::ref(ff) ));
+ CPPUNIT_ASSERT( s.find( v3, std::ref(ff) ));
CPPUNIT_ASSERT( v3.nFindCount == 1 );
v3.nFindCount = 0;
CPPUNIT_ASSERT( check_size( s, 3 ));
CPPUNIT_ASSERT( s.find( v3 ) == nullptr );
CPPUNIT_ASSERT( s.insert( v3 ));
CPPUNIT_ASSERT( v3.nFindCount == 0 );
- CPPUNIT_ASSERT( s.find_with( v3, less<value_type>(), cds::ref(ff) ));
+ CPPUNIT_ASSERT( s.find_with( v3, less<value_type>(), std::ref(ff) ));
CPPUNIT_ASSERT( v3.nFindCount == 1 );
v3.nFindCount = 0;
CPPUNIT_ASSERT( check_size( s, 3 ));
find_functor ff;
ASSERT_RCU_FIND( !s.find( v3 ));
CPPUNIT_ASSERT( v3.nVal != v3.nKey * 100 );
- CPPUNIT_ASSERT( s.insert( v3, cds::ref(fi) ));
+ CPPUNIT_ASSERT( s.insert( v3, std::ref(fi) ));
CPPUNIT_ASSERT( v3.nVal == v3.nKey * 100 );
CPPUNIT_ASSERT( v3.nFindCount == 0 );
- CPPUNIT_ASSERT( s.find_with( v3, less<value_type>(), cds::ref(ff) ));
+ CPPUNIT_ASSERT( s.find_with( v3, less<value_type>(), std::ref(ff) ));
CPPUNIT_ASSERT( v3.nFindCount == 1 );
v3.nFindCount = 0;
CPPUNIT_ASSERT( check_size( s, 3 ));
CPPUNIT_ASSERT( s.find( v3 ) == nullptr );
CPPUNIT_ASSERT( s.insert( v3 ));
CPPUNIT_ASSERT( v3.nFindCount == 0 );
- CPPUNIT_ASSERT( s.find( v3, cds::ref(ff) ));
+ CPPUNIT_ASSERT( s.find( v3, std::ref(ff) ));
CPPUNIT_ASSERT( v3.nFindCount == 1 );
v3.nFindCount = 0;
CPPUNIT_ASSERT( check_size( s, 3 ));
#include <cds/opt/hash.h>
#include <cds/os/timer.h>
-#include <cds/ref.h>
+#include <functional> // ref
#include <algorithm> // random_shuffle
// forward namespace declaration
{
copy_found<item> f;
key = 20;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( f.m_found.nFindCount == 1 );
{
copy_found<item> f;
key = 20;
- CPPUNIT_ASSERT( s.find_with( key, less<value_type>(), boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find_with( key, less<value_type>(), std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( f.m_found.nFindCount == 2 );
{
copy_found<item> f;
key = 25;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 25 );
CPPUNIT_ASSERT( f.m_found.nVal == 2500 );
}
key = 10;
{
copy_found<item> f;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 10 );
CPPUNIT_ASSERT( f.m_found.nVal == 10 );
CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
CPPUNIT_ASSERT( check_size( s, 3 ));
{
copy_found<item> f;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 10 );
CPPUNIT_ASSERT( f.m_found.nVal == 10 );
CPPUNIT_ASSERT( f.m_found.nEnsureCount == 1 );
{
copy_found<item> f;
key = 13;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 13 );
CPPUNIT_ASSERT( f.m_found.nVal == 1300 );
CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
CPPUNIT_ASSERT( s.find(20) );
{
copy_found<item> f;
- CPPUNIT_ASSERT( s.erase( 20, boost::ref(f) ));
+ CPPUNIT_ASSERT( s.erase( 20, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( s.insert(235))
- CPPUNIT_ASSERT( s.erase_with( 235, less<value_type>(), boost::ref(f) ));
+ CPPUNIT_ASSERT( s.erase_with( 235, less<value_type>(), std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 235 );
CPPUNIT_ASSERT( f.m_found.nVal == 235 );
}
{
copy_found<item> f;
key = 151;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 151 );
CPPUNIT_ASSERT( f.m_found.nVal == 151 );
key = 174;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 174 );
CPPUNIT_ASSERT( f.m_found.nVal == 471 );
key = 190;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 190 );
CPPUNIT_ASSERT( f.m_found.nVal == 91 );
}
#include <cds/opt/hash.h>
#include <cds/os/timer.h>
-#include <cds/ref.h>
+#include <functional> // ref
#include <algorithm> // random_shuffle
// forward namespace declaration
{
copy_found<item> f;
key = 20;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( f.m_found.nFindCount == 1 );
copy_found<item> f;
key = 20;
CPPUNIT_ASSERT( s.find( key, find_functor() ) );
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( f.m_found.nFindCount == 2 );
{
copy_found<item> f;
key = 25;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 25 );
CPPUNIT_ASSERT( f.m_found.nVal == 2500 );
}
key = 10;
{
copy_found<item> f;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 10 );
CPPUNIT_ASSERT( f.m_found.nVal == 10 );
CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
CPPUNIT_ASSERT( check_size( s, 3 ));
{
copy_found<item> f;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 10 );
CPPUNIT_ASSERT( f.m_found.nVal == 10 );
CPPUNIT_ASSERT( f.m_found.nEnsureCount == 1 );
{
copy_found<item> f;
key = 13;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 13 );
CPPUNIT_ASSERT( f.m_found.nVal == 1300 );
CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
CPPUNIT_ASSERT( s.find(20) );
{
copy_found<item> f;
- CPPUNIT_ASSERT( s.erase( 20, boost::ref(f) ));
+ CPPUNIT_ASSERT( s.erase( 20, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( s.insert(235))
- CPPUNIT_ASSERT( s.erase( 235, boost::ref(f) ));
+ CPPUNIT_ASSERT( s.erase( 235, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 235 );
CPPUNIT_ASSERT( f.m_found.nVal == 235 );
}
{
copy_found<item> f;
key = 151;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 151 );
CPPUNIT_ASSERT( f.m_found.nVal == 151 );
key = 174;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 174 );
CPPUNIT_ASSERT( f.m_found.nVal == 471 );
key = 190;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 190 );
CPPUNIT_ASSERT( f.m_found.nVal == 91 );
}
{
copy_found<item> f;
key = 20;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( f.m_found.nFindCount == 1 );
copy_found<item> f;
key = 20;
CPPUNIT_ASSERT( s.find_with( 20, less<value_type>(), find_functor() ) );
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( f.m_found.nFindCount == 2 );
{
copy_found<item> f;
key = 25;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 25 );
CPPUNIT_ASSERT( f.m_found.nVal == 2500 );
}
key = 10;
{
copy_found<item> f;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 10 );
CPPUNIT_ASSERT( f.m_found.nVal == 10 );
CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
CPPUNIT_ASSERT( check_size( s, 3 ));
{
copy_found<item> f;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 10 );
CPPUNIT_ASSERT( f.m_found.nVal == 10 );
CPPUNIT_ASSERT( f.m_found.nEnsureCount == 1 );
{
copy_found<item> f;
key = 13;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 13 );
CPPUNIT_ASSERT( f.m_found.nVal == 1300 );
CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
CPPUNIT_ASSERT( s.find(20) );
{
copy_found<item> f;
- CPPUNIT_ASSERT( s.erase( 20, boost::ref(f) ));
+ CPPUNIT_ASSERT( s.erase( 20, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( s.insert(235))
- CPPUNIT_ASSERT( s.erase_with( 235, less<value_type>(), boost::ref(f) ));
+ CPPUNIT_ASSERT( s.erase_with( 235, less<value_type>(), std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 235 );
CPPUNIT_ASSERT( f.m_found.nVal == 235 );
}
{
copy_found<item> f;
key = 151;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 151 );
CPPUNIT_ASSERT( f.m_found.nVal == 151 );
key = 174;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 174 );
CPPUNIT_ASSERT( f.m_found.nVal == 471 );
key = 190;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 190 );
CPPUNIT_ASSERT( f.m_found.nVal == 91 );
}
#include "cppunit/cppunit_proxy.h"
#include "size_check.h"
-#include <cds/ref.h>
+#include <functional> // ref
#include <algorithm>
namespace tree {
// find test
check_value chk(10);
- CPPUNIT_ASSERT( m.find( 10, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 10, std::ref(chk) ));
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find_with( 25, less(), boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find_with( 25, less(), std::ref( chk ) ) );
chk.m_nExpected = 90;
- CPPUNIT_ASSERT( m.find( 30, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 30, std::ref( chk ) ) );
chk.m_nExpected = 54;
- CPPUNIT_ASSERT( m.find( 27, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 27, std::ref( chk ) ) );
ensureResult = m.ensure( 10, insert_functor<Map>() ) ; // value = 50
CPPUNIT_ASSERT( ensureResult.first );
CPPUNIT_ASSERT( !ensureResult.second );
chk.m_nExpected = 50;
- CPPUNIT_ASSERT( m.find( 10, boost::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 10, std::ref( chk ) ) );
// erase test
CPPUNIT_ASSERT( !m.find(100) );
CPPUNIT_ASSERT( !m.find(29) );
CPPUNIT_ASSERT( m.insert(29, 290));
CPPUNIT_ASSERT( check_size( m, 4 ));
- CPPUNIT_ASSERT( m.erase_with( 29, less(), boost::ref(ext)));
+ CPPUNIT_ASSERT( m.erase_with( 29, less(), std::ref( ext ) ) );
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 3 ));
CPPUNIT_ASSERT( nVal == 290 );
nVal = -1;
- CPPUNIT_ASSERT( !m.erase_with( 29, less(), boost::ref(ext)));
+ CPPUNIT_ASSERT( !m.erase_with( 29, less(), std::ref( ext ) ) );
CPPUNIT_ASSERT( nVal == -1 );
- CPPUNIT_ASSERT( m.erase( 30, boost::ref(ext)));
+ CPPUNIT_ASSERT( m.erase( 30, std::ref( ext ) ) );
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 2 ));
CPPUNIT_ASSERT( nVal == 90 );
nVal = -1;
- CPPUNIT_ASSERT( !m.erase( 30, boost::ref(ext)));
+ CPPUNIT_ASSERT( !m.erase( 30, std::ref( ext ) ) );
CPPUNIT_ASSERT( nVal == -1 );
m.clear();
CPPUNIT_ASSERT( check_size( m, 3 ));
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find( 126, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 126, std::ref(chk) ));
chk.m_nExpected = 731;
- CPPUNIT_ASSERT( m.find_with( 137, less(), cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find_with( 137, less(), std::ref(chk) ));
chk.m_nExpected = 941;
- CPPUNIT_ASSERT( m.find( 149, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 149, std::ref(chk) ));
CPPUNIT_ASSERT( !m.emplace(126, 621)) ; // already in map
chk.m_nExpected = 0;
- CPPUNIT_ASSERT( m.find( 126, cds::ref(chk) ));
+ CPPUNIT_ASSERT( m.find( 126, std::ref(chk) ));
CPPUNIT_ASSERT( !m.empty() );
CPPUNIT_ASSERT( check_size( m, 3 ));
#include "cppunit/cppunit_proxy.h"
#include "size_check.h"
-#include <cds/ref.h>
+#include <functional> // ref
#include <algorithm>
namespace tree {
copy_found<value_type> f;
f.m_found.nKey = 0;
key = 20;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( f.m_found.stat.nFindFuncCall == 1 );
copy_found<value_type> f;
f.m_found.nKey = 0;
key = 20;
- CPPUNIT_ASSERT( s.find_with( key, less(), boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find_with( key, less(), std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( f.m_found.stat.nFindFuncCall == 2 );
{
copy_found<value_type> f;
f.m_found.nKey = 0;
- CPPUNIT_ASSERT( s.find_with( 20, less(), boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find_with( 20, less(), std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( f.m_found.stat.nFindFuncCall == 2 );
copy_found<value_type> f;
f.m_found.nKey = 0;
key = 25;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 25 );
CPPUNIT_ASSERT( f.m_found.nVal == 2500 );
CPPUNIT_ASSERT( f.m_found.stat.nInsertFuncCall == 1 );
{
copy_found<value_type> f;
f.m_found.nKey = 0;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 10 );
CPPUNIT_ASSERT( f.m_found.nVal == 100 );
CPPUNIT_ASSERT( f.m_found.stat.nEnsureExistFuncCall == 0 );
{
copy_found<value_type> f;
f.m_found.nKey = 0;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 10 );
CPPUNIT_ASSERT( f.m_found.nVal == 100 );
CPPUNIT_ASSERT( f.m_found.stat.nEnsureExistFuncCall == 1 );
copy_found<value_type> f;
f.m_found.nKey = 0;
key = 13;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 13 );
CPPUNIT_ASSERT( f.m_found.nVal == 1300 );
CPPUNIT_ASSERT( f.m_found.stat.nEnsureExistFuncCall == 0 );
{
copy_found<value_type> f;
f.m_found.nKey = 0;
- CPPUNIT_ASSERT( s.erase( 20, boost::ref(f) ));
+ CPPUNIT_ASSERT( s.erase( 20, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 20 );
CPPUNIT_ASSERT( f.m_found.nVal == 25 );
CPPUNIT_ASSERT( s.insert(235))
- CPPUNIT_ASSERT( s.erase_with( 235, less(), boost::ref(f) ));
+ CPPUNIT_ASSERT( s.erase_with( 235, less(), std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 235 );
CPPUNIT_ASSERT( f.m_found.nVal == 2350 );
}
copy_found<value_type> f;
f.m_found.nKey = 0;
key = 151;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 151 );
CPPUNIT_ASSERT( f.m_found.nVal == 1510 );
key = 174;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 174 );
CPPUNIT_ASSERT( f.m_found.nVal == 471 );
key = 190;
- CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+ CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
CPPUNIT_ASSERT( f.m_found.nKey == 190 );
CPPUNIT_ASSERT( f.m_found.nVal == 91 );
}
//$$CDS-header$$
+#include <functional>
#include "map2/map_types.h"
#include "cppunit/thread.h"
#include <cds/lock/spinlock.h>
#include <vector>
#include <algorithm> // random_shuffle
-#include <boost/ref.hpp>
namespace map2 {
if ( m_nThreadNo & 1 ) {
for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
for ( key_array::const_iterator it = arr.begin(), itEnd = arr.end(); it != itEnd; ++it ) {
- if ( rMap.insert_key( *it, cds::ref(func) ) )
+ if ( rMap.insert_key( *it, std::ref(func) ) )
++m_nInsertSuccess;
else
++m_nInsertFailed;
else {
for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
for ( key_array::const_reverse_iterator it = arr.rbegin(), itEnd = arr.rend(); it != itEnd; ++it ) {
- if ( rMap.insert_key( *it, cds::ref(func) ) )
+ if ( rMap.insert_key( *it, std::ref(func) ) )
++m_nInsertSuccess;
else
++m_nInsertFailed;
for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
for ( key_array::const_iterator it = arr.begin(), itEnd = arr.end(); it != itEnd; ++it ) {
//for ( size_t nItem = 0; nItem < c_nMapSize; ++nItem ) {
- std::pair<bool, bool> ret = rMap.ensure( *it, cds::ref( func ) );
+ std::pair<bool, bool> ret = rMap.ensure( *it, std::ref( func ) );
if ( ret.first ) {
if ( ret.second )
++m_nEnsureCreated;
for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
for ( key_array::const_reverse_iterator it = arr.rbegin(), itEnd = arr.rend(); it != itEnd; ++it ) {
//for ( size_t nItem = c_nMapSize; nItem > 0; --nItem ) {
- std::pair<bool, bool> ret = rMap.ensure( *it, cds::ref( func ) );
+ std::pair<bool, bool> ret = rMap.ensure( *it, std::ref( func ) );
if ( ret.first ) {
if ( ret.second )
++m_nEnsureCreated;
for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
for ( key_array::const_iterator it = arr.begin(), itEnd = arr.end(); it != itEnd; ++it ) {
func.m_cnt.nKeyExpected = *it;
- if ( rMap.erase( *it, cds::ref(func) ))
+ if ( rMap.erase( *it, std::ref(func) ))
++m_nDeleteSuccess;
else
++m_nDeleteFailed;
for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
for ( key_array::const_reverse_iterator it = arr.rbegin(), itEnd = arr.rend(); it != itEnd; ++it ) {
func.m_cnt.nKeyExpected = *it;
- if ( rMap.erase( *it, cds::ref(func) ))
+ if ( rMap.erase( *it, std::ref(func) ))
++m_nDeleteSuccess;
else
++m_nDeleteFailed;
#define __CDSUNIT_STD_HASH_MAP_GCC_H
#include <unordered_map>
-#include <cds/ref.h>
+#include <functional> // ref
namespace map2 {
AutoLock al( m_lock );
std::pair<typename base_class::iterator, bool> pRet = base_class::insert( typename base_class::value_type(key, Value() ));
if ( pRet.second ) {
- cds::unref(func)( pRet.first->second, val );
+ func( pRet.first->second, val );
return true;
}
return false;
AutoLock al( m_lock );
std::pair<typename base_class::iterator, bool> pRet = base_class::insert( typename base_class::value_type( key, Value() ));
if ( pRet.second ) {
- cds::unref(func)( true, *pRet.first );
+ func( true, *pRet.first );
return std::make_pair( true, true );
}
else {
- cds::unref(func)( false, *pRet.first );
+ func( false, *pRet.first );
return std::make_pair( true, false );
}
}
AutoLock al( m_lock );
typename base_class::iterator it = base_class::find( key );
if ( it != base_class::end() ) {
- cds::unref(func)( *it );
+ func( *it );
return base_class::erase( key ) != 0;
}
return false;
#define __CDSUNIT_STD_HASH_MAP_VC_H
#include <hash_map>
-#include <cds/ref.h>
+#include <functional> // ref
namespace map2 {
template <typename Key, typename Value, typename Lock, class Alloc = CDS_DEFAULT_ALLOCATOR>
AutoLock al( m_lock );
std::pair<base_class::iterator, bool> pRet = base_class::insert( base_class::value_type(key, Value() ));
if ( pRet.second ) {
- cds::unref(func)( pRet.first->second, val );
+ func( pRet.first->second, val );
return true;
}
return false;
AutoLock al( m_lock );
std::pair<base_class::iterator, bool> pRet = base_class::insert( base_class::value_type(key, Value() ));
if ( pRet.second ) {
- cds::unref(func)( true, *pRet.first );
+ func( true, *pRet.first );
return std::make_pair( true, true );
}
else {
- cds::unref(func)( false, *pRet.first );
+ func( false, *pRet.first );
return std::make_pair( true, false );
}
}
AutoLock al( m_lock );
base_class::iterator it = base_class::find( key );
if ( it != base_class::end() ) {
- cds::unref(func)( *it );
+ func( *it );
return base_class::erase( key ) != 0;
}
return false;
#define __CDSUNIT_STD_MAP_GCC_H
#include <map>
-#include <cds/ref.h>
+#include <functional> // ref
namespace map2 {
AutoLock al( m_lock );
std::pair<typename base_class::iterator, bool> pRet = base_class::insert( typename base_class::value_type(key, Value() ));
if ( pRet.second ) {
- cds::unref(func)( pRet.first->second, val );
+ func( pRet.first->second, val );
return true;
}
return false;
AutoLock al( m_lock );
std::pair<typename base_class::iterator, bool> pRet = base_class::insert( typename base_class::value_type(key, Value() ));
if ( pRet.second ) {
- cds::unref(func)( true, *pRet.first );
+ func( true, *pRet.first );
return std::make_pair( true, true );
}
else {
- cds::unref(func)( false, *pRet.first );
+ func( false, *pRet.first );
return std::make_pair( true, false );
}
}
AutoLock al( m_lock );
typename base_class::iterator it = base_class::find( key );
if ( it != base_class::end() ) {
- cds::unref(func)( (*it) );
+ func( (*it) );
base_class::erase( it );
return true;
}
#define __CDSUNIT_STD_MAP_VC_H
#include <map>
-#include <cds/ref.h>
+#include <functional> // ref
namespace map2 {
template <typename Key, typename Value, typename Lock, class Alloc = CDS_DEFAULT_ALLOCATOR>
AutoLock al( m_lock );
std::pair<base_class::iterator, bool> pRet = base_class::insert( base_class::value_type(key, Value() ));
if ( pRet.second ) {
- cds::unref(func)( pRet.first->second, val );
+ func( pRet.first->second, val );
return true;
}
return false;
AutoLock al( m_lock );
std::pair<base_class::iterator, bool> pRet = base_class::insert( base_class::value_type(key, Value() ));
if ( pRet.second ) {
- cds::unref(func)( true, *pRet.first );
+ func( true, *pRet.first );
return std::make_pair( true, true );
}
else {
- cds::unref(func)( false, *pRet.first );
+ func( false, *pRet.first );
return std::make_pair( true, false );
}
}
AutoLock al( m_lock );
base_class::iterator it = base_class::find( key );
if ( it != base_class::end() ) {
- cds::unref(func)( *it );
+ func( *it );
base_class::erase( it );
return true;
//$$CDS-header$$
+#include <functional>
+#include <vector>
+
#include "set2/set_types.h"
#include "cppunit/thread.h"
#include <cds/lock/spinlock.h>
-#include <vector>
-#include <boost/ref.hpp>
namespace set2 {
if ( m_nThreadNo & 1 ) {
for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
for ( size_t * p = pKeyFirst; p < pKeyLast; ++p ) {
- if ( rSet.insert( *p, cds::ref(func) ) )
+ if ( rSet.insert( *p, std::ref(func) ) )
++m_nInsertSuccess;
else
++m_nInsertFailed;
else {
for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
for ( size_t * p = pKeyLast - 1; p >= pKeyFirst; --p ) {
- if ( rSet.insert( *p, cds::ref(func) ) )
+ if ( rSet.insert( *p, std::ref(func) ) )
++m_nInsertSuccess;
else
++m_nInsertFailed;
if ( m_nThreadNo & 1 ) {
for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
for ( size_t * p = pKeyFirst; p < pKeyLast; ++p ) {
- std::pair<bool, bool> ret = rSet.ensure( *p, cds::ref( func ) );
+ std::pair<bool, bool> ret = rSet.ensure( *p, std::ref( func ) );
if ( ret.first ) {
if ( ret.second )
++m_nEnsureCreated;
else {
for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
for ( size_t * p = pKeyLast - 1 ; p >= pKeyFirst; --p ) {
- std::pair<bool, bool> ret = rSet.ensure( *p, cds::ref( func ) );
+ std::pair<bool, bool> ret = rSet.ensure( *p, std::ref( func ) );
if ( ret.first ) {
if ( ret.second )
++m_nEnsureCreated;
for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
for ( size_t * p = pKeyFirst; p < pKeyLast; ++p ) {
func.m_cnt.nKeyExpected = *p;
- if ( rSet.erase( *p, cds::ref(func) ))
+ if ( rSet.erase( *p, std::ref(func) ))
++m_nDeleteSuccess;
else
++m_nDeleteFailed;
for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) {
for ( size_t * p = pKeyLast - 1; p >= pKeyFirst; --p ) {
func.m_cnt.nKeyExpected = *p;
- if ( rSet.erase( *p, cds::ref(func) ))
+ if ( rSet.erase( *p, std::ref(func) ))
++m_nDeleteSuccess;
else
++m_nDeleteFailed;
#define __CDSUNIT_STD_HASH_SET_STD_H
#include <unordered_set>
-#include <cds/ref.h>
+#include <functional> // ref
namespace set2 {
AutoLock al( m_lock );
std::pair<typename base_class::iterator, bool> pRet = base_class::insert( value_type( key ));
if ( pRet.second ) {
- cds::unref(func)( *pRet.first );
+ func( *pRet.first );
return true;
}
return false;
AutoLock al( m_lock );
std::pair<typename base_class::iterator, bool> pRet = base_class::insert( value_type( key ));
if ( pRet.second ) {
- cds::unref(func)( true, *pRet.first, key );
+ func( true, *pRet.first, key );
return std::make_pair( true, true );
}
else {
- cds::unref(func)( false, *pRet.first, key );
+ func( false, *pRet.first, key );
return std::make_pair( true, false );
}
}
AutoLock al( m_lock );
typename base_class::iterator it = base_class::find( value_type(key) );
if ( it != base_class::end() ) {
- cds::unref(func)( *it );
+ func( *it );
return base_class::erase( it ) != base_class::end();
}
return false;
#define __CDSUNIT_STD_HASH_SET_VC_H
#include <hash_set>
-//#include <cds/ref.h>
namespace set2 {
AutoLock al( m_lock );
std::pair<base_class::iterator, bool> pRet = base_class::insert( value_type( key ));
if ( pRet.second ) {
- cds::unref(func)( *pRet.first );
+ func( *pRet.first );
return true;
}
return false;
AutoLock al( m_lock );
std::pair<typename base_class::iterator, bool> pRet = base_class::insert( value_type( key ));
if ( pRet.second ) {
- cds::unref(func)( true, *pRet.first, key );
+ func( true, *pRet.first, key );
return std::make_pair( true, true );
}
else {
- cds::unref(func)( false, *pRet.first, key );
+ func( false, *pRet.first, key );
return std::make_pair( true, false );
}
}
AutoLock al( m_lock );
base_class::iterator it = base_class::find( key );
if ( it != base_class::end() ) {
- cds::unref(func)( *it );
+ func( *it );
return base_class::erase( it ) != base_class::end();
}
return false;
#define __CDSUNIT_STD_SET_VC_H
#include <set>
-#include <cds/ref.h>
+#include <functional> // ref
namespace set2 {
template <typename Value, typename Less, typename Lock,
AutoLock al( m_lock );
std::pair<typename base_class::iterator, bool> pRet = base_class::insert( value_type( key ));
if ( pRet.second ) {
- cds::unref(func)( *pRet.first );
+ func( *pRet.first );
return true;
}
return false;
AutoLock al( m_lock );
std::pair<typename base_class::iterator, bool> pRet = base_class::insert( value_type( key ));
if ( pRet.second ) {
- cds::unref(func)( true, *pRet.first, key );
+ func( true, *pRet.first, key );
return std::make_pair( true, true );
}
else {
- cds::unref(func)( false, *pRet.first, key );
+ func( false, *pRet.first, key );
return std::make_pair( true, false );
}
}
AutoLock al( m_lock );
typename base_class::iterator it = base_class::find( value_type(key) );
if ( it != base_class::end() ) {
- cds::unref(func)( *it );
+ func( *it );
base_class::erase( it );
return true;