#define __CDS_CONTAINER_MICHAEL_KVLIST_NOGC_H
#include <memory>
-#include <cds/container/michael_list_base.h>
+#include <cds/container/details/michael_list_base.h>
#include <cds/intrusive/michael_list_nogc.h>
#include <cds/container/details/make_michael_kvlist.h>
#include <cds/details/functor_wrapper.h>
typedef typename base_class::atomic_node_ptr head_type;
//@endcond
- private:
- //@cond
-# ifndef CDS_CXX11_LAMBDA_SUPPORT
- struct ensure_functor
- {
- node_type * m_pItemFound;
-
- ensure_functor()
- : m_pItemFound( nullptr )
- {}
-
- void operator ()(bool, node_type& item, node_type& )
- {
- m_pItemFound = &item;
- }
- };
-
- template <typename Func>
- class find_functor: protected cds::details::functor_wrapper<Func>
- {
- typedef cds::details::functor_wrapper<Func> base_class;
- public:
- find_functor( Func f )
- : base_class(f)
- {}
-
- template <typename Q>
- void operator ()( node_type& node, Q& )
- {
- base_class::get()( node.m_Data );
- }
- };
-# endif
- //@endcond
-
protected:
//@cond
template <typename K>
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;
scoped_node_ptr pNode( alloc_node( key ));
node_type * pItemFound = nullptr;
-# ifdef CDS_CXX11_LAMBDA_SUPPORT
std::pair<bool, bool> ret = base_class::ensure_at( refHead, *pNode, [&pItemFound](bool, node_type& item, node_type&){ pItemFound = &item; });
-# else
- ensure_functor func;
- std::pair<bool, bool> ret = base_class::ensure_at( refHead, *pNode, boost::ref(func) );
- pItemFound = func.m_pItemFound;
-# endif
assert( pItemFound != nullptr );
if ( ret.first && ret.second )
template <typename K, typename Compare typename Func>
bool find_at( head_type& refHead, K& key, Compare cmp, Func f )
{
-# ifdef CDS_CXX11_LAMBDA_SUPPORT
- return base_class::find_at( refHead, key, cmp, [&f]( node_type& node, K const& ){ cds::unref(f)( node.m_Data ); });
-# else
- find_functor<Func> wrapper( f );
- return base_class::find_at( refHead, key, cmp, cds::ref(wrapper) );
-# endif
+ return base_class::find_at( refHead, key, cmp, [&f]( node_type& node, K const& ){ f( node.m_Data ); });
}
*/
//@endcond