X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=blobdiff_plain;f=cds%2Fcontainer%2Fellen_bintree_set_rcu.h;h=949f5c09ab8efeb95f01448b1e4848a797448dc7;hp=579da7a99e32a872648778f6527580ae330aba35;hb=7dac077c1f71d753e833caf9a8db36e3ad5793e7;hpb=8abed38e557d344d68892b9ea16b0bde63ba5ccb diff --git a/cds/container/ellen_bintree_set_rcu.h b/cds/container/ellen_bintree_set_rcu.h index 579da7a9..949f5c09 100644 --- a/cds/container/ellen_bintree_set_rcu.h +++ b/cds/container/ellen_bintree_set_rcu.h @@ -176,74 +176,6 @@ namespace cds { namespace container { cds::urcu::details::conventional_exempt_member_cast > exempt_ptr; - protected: - //@cond -# ifndef CDS_CXX11_LAMBDA_SUPPORT - template - struct insert_functor - { - Func m_func; - - insert_functor ( Func f ) - : m_func(f) - {} - - void operator()( leaf_node& node ) - { - cds::unref(m_func)( node.m_Value ); - } - }; - - template - struct ensure_functor - { - Func m_func; - Q const& m_arg; - - ensure_functor( Q const& arg, Func f ) - : m_func(f) - , m_arg( arg ) - {} - - void operator ()( bool bNew, leaf_node& node, leaf_node& ) - { - cds::unref(m_func)( bNew, node.m_Value, m_arg ); - } - }; - - template - struct erase_functor - { - Func m_func; - - erase_functor( Func f ) - : m_func(f) - {} - - void operator()( leaf_node const& node ) - { - cds::unref(m_func)( node.m_Value ); - } - }; - - template - struct find_functor - { - Func m_func; - - find_functor( Func f ) - : m_func(f) - {} - - template - void operator ()( leaf_node& node, Q& val ) - { - cds::unref(m_func)( node.m_Value, val ); - } - }; -#endif - //@endcond - public: /// Default constructor EllenBinTreeSet() @@ -300,13 +232,7 @@ namespace cds { namespace container { bool insert( Q const& val, Func f ) { scoped_node_ptr sp( cxx_leaf_node_allocator().New( val )); -# ifdef CDS_CXX11_LAMBDA_SUPPORT - if ( base_class::insert( *sp.get(), [&f]( leaf_node& val ) { cds::unref(f)( val.m_Value ); } )) -# else - insert_functor wrapper(f); - if ( base_class::insert( *sp, cds::ref(wrapper) )) -# endif - { + if ( base_class::insert( *sp.get(), [&f]( leaf_node& val ) { cds::unref(f)( val.m_Value ); } )) { sp.release(); return true; } @@ -350,13 +276,8 @@ namespace cds { namespace container { std::pair ensure( const Q& val, Func func ) { scoped_node_ptr sp( cxx_leaf_node_allocator().New( val )); -# ifdef CDS_CXX11_LAMBDA_SUPPORT std::pair bRes = base_class::ensure( *sp, [&func, &val](bool bNew, leaf_node& node, leaf_node&){ cds::unref(func)( bNew, node.m_Value, val ); }); -# else - ensure_functor wrapper( val, func ); - std::pair bRes = base_class::ensure( *sp, cds::ref(wrapper)); -# endif if ( bRes.first && bRes.second ) sp.release(); return bRes; @@ -436,12 +357,7 @@ namespace cds { namespace container { template bool erase( Q const& key, Func f ) { -# ifdef CDS_CXX11_LAMBDA_SUPPORT return base_class::erase( key, [&f]( leaf_node const& node) { cds::unref(f)( node.m_Value ); } ); -# else - erase_functor wrapper(f); - return base_class::erase( key, cds::ref(wrapper)); -# endif } /// Deletes the item from the set using \p pred predicate for searching @@ -454,13 +370,8 @@ namespace cds { namespace container { template bool erase_with( Q const& key, Less pred, Func f ) { -# ifdef CDS_CXX11_LAMBDA_SUPPORT 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 ); } ); -# else - erase_functor wrapper(f); - return base_class::erase_with( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >(), cds::ref(wrapper)); -# endif } /// Extracts an item with minimal key from the set @@ -571,12 +482,7 @@ namespace cds { namespace container { template bool find( Q& val, Func f ) const { -# ifdef CDS_CXX11_LAMBDA_SUPPORT return base_class::find( val, [&f]( leaf_node& node, Q& v ) { cds::unref(f)( node.m_Value, v ); }); -# else - find_functor wrapper(f); - return base_class::find( val, cds::ref(wrapper)); -# endif } /// Finds the key \p val using \p pred predicate for searching @@ -589,14 +495,8 @@ namespace cds { namespace container { template bool find_with( Q& val, Less pred, Func f ) const { -# ifdef CDS_CXX11_LAMBDA_SUPPORT 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 ); } ); -# else - find_functor wrapper(f); - return base_class::find_with( val, cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >(), - cds::ref(wrapper)); -# endif } /// Find the key \p val @@ -628,12 +528,7 @@ namespace cds { namespace container { template bool find( Q const& val, Func f ) const { -# ifdef CDS_CXX11_LAMBDA_SUPPORT return base_class::find( val, [&f]( leaf_node& node, Q const& v ) { cds::unref(f)( node.m_Value, v ); }); -# else - find_functor wrapper(f); - return base_class::find( val, cds::ref(wrapper)); -# endif } /// Finds the key \p val using \p pred predicate for searching @@ -646,14 +541,8 @@ namespace cds { namespace container { template bool find_with( Q const& val, Less pred, Func f ) const { -# ifdef CDS_CXX11_LAMBDA_SUPPORT 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 ); } ); -# else - find_functor wrapper(f); - return base_class::find_with( val, cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >(), - cds::ref(wrapper)); -# endif } /// Find the key \p val