Remove CDS_CXX11_LAMBDA_SUPPORT macro and a lot of emulating code
[libcds.git] / cds / container / cuckoo_set.h
index 8c24b107ab922b479a1486c19c2429bf60119733..348f02dfb3b19ab842216d1826059a22d9ce135f 100644 (file)
@@ -419,62 +419,6 @@ namespace cds { namespace container {
 
         typedef std::unique_ptr< node_type, node_disposer >     scoped_node_ptr;
 
-#   ifndef CDS_CXX11_LAMBDA_SUPPORT
-        struct empty_insert_functor {
-            void operator()( value_type& ) const
-            {}
-        };
-
-        struct empty_find_functor {
-            template <typename Q>
-            void operator()( node_type& item, Q& val ) const
-            {}
-        };
-
-        template <typename Func>
-        class insert_wrapper: protected cds::details::functor_wrapper<Func>
-        {
-            typedef cds::details::functor_wrapper<Func> base_class;
-        public:
-            insert_wrapper( Func f ): base_class(f) {}
-
-            void operator()( node_type& node )
-            {
-                base_class::get()( node.m_val );
-            }
-        };
-
-        template <typename Q, typename Func>
-        class ensure_wrapper: protected cds::details::functor_wrapper<Func>
-        {
-            typedef cds::details::functor_wrapper<Func> base_class;
-        public:
-            Q const&    val;
-
-            ensure_wrapper( Q const& v, Func f) : base_class(f), val(v) {}
-
-            void operator()( bool bNew, node_type& item, node_type const& )
-            {
-                base_class::get()( bNew, item.m_val, val );
-            }
-        };
-
-        template <typename Func>
-        class find_wrapper: protected cds::details::functor_wrapper<Func>
-        {
-            typedef cds::details::functor_wrapper<Func> base_class;
-        public:
-            find_wrapper( Func f )
-                : base_class(f)
-            {}
-
-            template <typename Q>
-            void operator()( node_type& item, Q& val )
-            {
-                base_class::get()( item.m_val, val );
-            }
-        };
-#   endif
         //@endcond
 
     public:
@@ -573,11 +517,7 @@ namespace cds { namespace container {
         template <typename Q>
         bool insert( Q const& val )
         {
-#       ifdef CDS_CXX11_LAMBDA_SUPPORT
             return insert( val, []( value_type& ) {} );
-#       else
-            return insert( val, empty_insert_functor() );
-#       endif
         }
 
         /// Inserts new node
@@ -603,13 +543,7 @@ namespace cds { namespace container {
         bool insert( Q const& val, Func f )
         {
             scoped_node_ptr pNode( alloc_node( val ));
-#       ifdef CDS_CXX11_LAMBDA_SUPPORT
-            if ( base_class::insert( *pNode, [&f]( node_type& node ) { cds::unref(f)( node.m_val ); } ))
-#       else
-            insert_wrapper<Func> wrapper( f );
-            if ( base_class::insert( *pNode, cds::ref(wrapper) ))
-#       endif
-            {
+            if ( base_class::insert( *pNode, [&f]( node_type& node ) { cds::unref(f)( node.m_val ); } )) {
                 pNode.release();
                 return true;
             }
@@ -665,14 +599,9 @@ namespace cds { namespace container {
         std::pair<bool, bool> ensure( Q const& val, Func func )
         {
             scoped_node_ptr pNode( alloc_node( val ));
-#       ifdef CDS_CXX11_LAMBDA_SUPPORT
             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 ); }
             );
-#       else
-            ensure_wrapper<Q, Func> wrapper( val, func );
-            std::pair<bool, bool> res = base_class::ensure( *pNode, cds::ref(wrapper) );
-#       endif
             if ( res.first && res.second )
                 pNode.release();
             return res;
@@ -792,12 +721,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& item, Q& v) { cds::unref(f)( item.m_val, v );});
-#       else
-            find_wrapper<Func> wrapper(f);
-            return base_class::find( val, cds::ref(wrapper) );
-#       endif
         }
 
         /// Find the key \p val using \p pred predicate for comparing
@@ -811,13 +735,8 @@ namespace cds { namespace container {
         template <typename Q, typename Predicate, typename Func>
         bool find_with( Q& val, Predicate pred, Func f )
         {
-#       ifdef CDS_CXX11_LAMBDA_SUPPORT
             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 );});
-#       else
-            find_wrapper<Func> wrapper(f);
-            return base_class::find_with( val, typename maker::template predicate_wrapper<Predicate, bool>(), cds::ref(wrapper) );
-#       endif
         }
 
         /// Find the key \p val
@@ -844,12 +763,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& item, Q const& v) { cds::unref(f)( item.m_val, v );});
-#       else
-            find_wrapper<Func> wrapper(f);
-            return base_class::find( val, cds::ref(wrapper) );
-#       endif
         }
 
         /// Find the key \p val using \p pred predicate for comparing
@@ -863,13 +777,8 @@ namespace cds { namespace container {
         template <typename Q, typename Predicate, typename Func>
         bool find_with( Q const& val, Predicate pred, Func f )
         {
-#       ifdef CDS_CXX11_LAMBDA_SUPPORT
             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 );});
-#       else
-            find_wrapper<Func> wrapper(f);
-            return base_class::find_with( val, typename maker::template predicate_wrapper<Predicate, bool>(), cds::ref(wrapper) );
-#       endif
         }
 
         /// Find the key \p val
@@ -884,11 +793,7 @@ namespace cds { namespace container {
         template <typename Q>
         bool find( Q const& val )
         {
-#       ifdef CDS_CXX11_LAMBDA_SUPPORT
             return base_class::find( val, [](node_type&, Q const&) {});
-#       else
-            return base_class::find( val, empty_find_functor());
-#       endif
         }
 
         /// Find the key \p val using \p pred predicate for comparing
@@ -902,11 +807,7 @@ namespace cds { namespace container {
         template <typename Q, typename Predicate>
         bool find_with( Q const& val, Predicate pred )
         {
-#       ifdef CDS_CXX11_LAMBDA_SUPPORT
             return base_class::find_with( val, typename maker::template predicate_wrapper<Predicate, bool>(), [](node_type&, Q const&) {});
-#       else
-            return base_class::find_with( val, typename maker::template predicate_wrapper<Predicate, bool>(), empty_find_functor());
-#       endif
         }
 
         /// Clears the set