Remove CDS_CXX11_LAMBDA_SUPPORT macro and a lot of emulating code
[libcds.git] / cds / container / skip_list_set_rcu.h
index 2ea9f4970937d56e994f66c945e73308708404c2..632f2f9d78d6b0528e3909d2e75b4413df3f7428 100644 (file)
@@ -200,99 +200,6 @@ namespace cds { namespace container {
         }
         //@endcond
 
-    protected:
-        //@cond
-#   ifndef CDS_CXX11_LAMBDA_SUPPORT
-        template <typename Func>
-        struct insert_functor
-        {
-            Func        m_func;
-
-            insert_functor ( Func f )
-                : m_func(f)
-            {}
-
-            void operator()( node_type& node )
-            {
-                cds::unref(m_func)( node.m_Value );
-            }
-        };
-
-        template <typename Q, typename Func>
-        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, node_type& node, node_type& )
-            {
-                cds::unref(m_func)( bNew, node.m_Value, m_arg );
-            }
-        };
-
-        template <typename Func>
-        struct find_functor
-        {
-            Func    m_func;
-
-            find_functor( Func f )
-                : m_func(f)
-            {}
-
-            template <typename Q>
-            void operator ()( node_type& node, Q& val )
-            {
-                cds::unref(m_func)( node.m_Value, val );
-            }
-        };
-
-        template <typename Func>
-        struct erase_functor
-        {
-            Func        m_func;
-
-            erase_functor( Func f )
-                : m_func(f)
-            {}
-
-            void operator()( node_type const& node )
-            {
-                cds::unref(m_func)( node.m_Value );
-            }
-        };
-
-        template <typename Func>
-        struct extract_copy_wrapper
-        {
-            Func    m_func;
-            extract_copy_wrapper( Func f )
-                : m_func(f)
-            {}
-
-            template <typename Q>
-            void operator()( Q& dest, node_type& src )
-            {
-                cds::unref(m_func)(dest, src.m_Value);
-            }
-        };
-
-        struct extract_assign_wrapper
-        {
-            template <typename Q>
-            void operator()( Q& dest, node_type& src ) const
-            {
-                dest = src.m_Value;
-            }
-        };
-#   endif  // ifndef CDS_CXX11_LAMBDA_SUPPORT
-
-        //@endcond
-
     public:
         /// Default ctor
         SkipListSet()
@@ -393,13 +300,7 @@ namespace cds { namespace container {
         bool insert( Q const& val, Func f )
         {
             scoped_node_ptr sp( node_allocator().New( random_level(), val ));
-#       ifdef CDS_CXX11_LAMBDA_SUPPORT
-            if ( base_class::insert( *sp.get(), [&f]( node_type& val ) { cds::unref(f)( val.m_Value ); } ))
-#       else
-            insert_functor<Func> wrapper(f);
-            if ( base_class::insert( *sp, cds::ref(wrapper) ))
-#       endif
-            {
+            if ( base_class::insert( *sp.get(), [&f]( node_type& val ) { cds::unref(f)( val.m_Value ); } )) {
                 sp.release();
                 return true;
             }
@@ -443,13 +344,8 @@ namespace cds { namespace container {
         std::pair<bool, bool> ensure( const Q& val, Func func )
         {
             scoped_node_ptr sp( node_allocator().New( random_level(), val ));
-#       ifdef CDS_CXX11_LAMBDA_SUPPORT
             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 ); });
-#       else
-            ensure_functor<Q, Func> wrapper( val, func );
-            std::pair<bool, bool> bRes = base_class::ensure( *sp, cds::ref(wrapper));
-#       endif
             if ( bRes.first && bRes.second )
                 sp.release();
             return bRes;
@@ -529,12 +425,7 @@ namespace cds { namespace container {
         template <typename Q, typename Func>
         bool erase( Q const& key, Func f )
         {
-#       ifdef CDS_CXX11_LAMBDA_SUPPORT
             return base_class::erase( key, [&f]( node_type const& node) { cds::unref(f)( node.m_Value ); } );
-#       else
-            erase_functor<Func> wrapper(f);
-            return base_class::erase( key, cds::ref(wrapper));
-#       endif
         }
 
         /// Deletes the item from the set using \p pred predicate for searching
@@ -547,13 +438,8 @@ namespace cds { namespace container {
         template <typename Q, typename Less, typename Func>
         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< node_type, Less, typename maker::value_accessor >(),
                 [&f]( node_type const& node) { cds::unref(f)( node.m_Value ); } );
-#       else
-            erase_functor<Func> wrapper(f);
-            return base_class::erase_with( key, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >(), cds::ref(wrapper));
-#       endif
         }
 
         /// Extracts the item from the set with specified \p key
@@ -655,12 +541,7 @@ namespace cds { namespace container {
         template <typename Q, typename Func>
         bool find( Q& val, Func f )
         {
-#       ifdef CDS_CXX11_LAMBDA_SUPPORT
             return base_class::find( val, [&f]( node_type& node, Q& v ) { cds::unref(f)( node.m_Value, v ); });
-#       else
-            find_functor<Func> wrapper(f);
-            return base_class::find( val, cds::ref(wrapper));
-#       endif
         }
 
         /// Finds the key \p val using \p pred predicate for searching
@@ -673,14 +554,8 @@ namespace cds { namespace container {
         template <typename Q, typename Less, typename Func>
         bool find_with( Q& val, Less pred, Func f )
         {
-#       ifdef CDS_CXX11_LAMBDA_SUPPORT
             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 ); } );
-#       else
-            find_functor<Func> wrapper(f);
-            return base_class::find_with( val, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >(),
-                cds::ref(wrapper));
-#       endif
         }
 
         /// Find the key \p val
@@ -712,12 +587,7 @@ namespace cds { namespace container {
         template <typename Q, typename Func>
         bool find( Q const& val, Func f )
         {
-#       ifdef CDS_CXX11_LAMBDA_SUPPORT
             return base_class::find( val, [&f]( node_type& node, Q const& v ) { cds::unref(f)( node.m_Value, v ); });
-#       else
-            find_functor<Func> wrapper(f);
-            return base_class::find( val, cds::ref(wrapper));
-#       endif
         }
 
         /// Finds the key \p val using \p pred predicate for searching
@@ -730,14 +600,8 @@ namespace cds { namespace container {
         template <typename Q, typename Less, typename Func>
         bool find_with( Q const& val, Less pred, Func f )
         {
-#       ifdef CDS_CXX11_LAMBDA_SUPPORT
             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 ); } );
-#       else
-            find_functor<Func> wrapper(f);
-            return base_class::find_with( val, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >(),
-                cds::ref(wrapper));
-#       endif
         }
 
         /// Find the key \p val