Removed redundant spaces
[libcds.git] / cds / container / split_list_map_rcu.h
index b42ee5bc6bc5cd14e22e2fd3a9588d5f902376a9..9dc68aa8820fe668d3e8a8a8b8c269c160daae1a 100644 (file)
@@ -1,7 +1,35 @@
-//$$CDS-header$$
+/*
+    This file is a part of libcds - Concurrent Data Structures library
 
-#ifndef __CDS_CONTAINER_SPLIT_LIST_MAP_RCU_H
-#define __CDS_CONTAINER_SPLIT_LIST_MAP_RCU_H
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    Source code repo: http://github.com/khizmax/libcds/
+    Download: http://sourceforge.net/projects/libcds/files/
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this
+      list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef CDSLIB_CONTAINER_SPLIT_LIST_MAP_RCU_H
+#define CDSLIB_CONTAINER_SPLIT_LIST_MAP_RCU_H
 
 #include <cds/container/split_list_set_rcu.h>
 #include <cds/details/binary_functor_wrapper.h>
@@ -20,26 +48,22 @@ namespace cds { namespace container {
 
         Template parameters:
         - \p RCU - one of \ref cds_urcu_gc "RCU type"
-        - \p Key - key type of an item stored in the map. It should be copy-constructible
-        - \p Value - value type stored in the map
-        - \p Traits - type traits, default is split_list::type_traits. Instead of declaring split_list::type_traits -based
-            struct you may apply option-based notation with split_list::make_traits metafunction.
+        - \p Key - key type to be stored in the map
+        - \p Value - value type to be stored in the map
+        - \p Traits - type traits, default is \p split_list::traits. Instead of declaring \p %split_list::traits -based
+            struct you may apply option-based notation with \p split_list::make_traits metafunction.
 
         <b>Iterators</b>
 
-        The class supports a forward iterator (\ref iterator and \ref const_iterator).
-        The iteration is unordered.
-
+        The class supports a forward unordered iterator (\ref iterator and \ref const_iterator).
         You may iterate over split-list map items only under RCU lock.
         Only in this case the iterator is thread-safe since
         while RCU is locked any map's item cannot be reclaimed.
-
-        The requirement of RCU lock during iterating means that deletion of the elements (i.e. \ref erase)
+        The requirement of RCU lock during iterating means that deletion of the elements
         is not possible.
 
-        @warning The iterator object cannot be passed between threads
-
-        \warning Due to concurrent nature of split-list map it is not guarantee that you can iterate
+        @warning The iterator object cannot be passed between threads.
+        Due to concurrent nature of split-list map it is not guarantee that you can iterate
         all elements in the map: any concurrent deletion can exclude the element
         pointed by the iterator from the map, and your iteration can be terminated
         before end of the map. Therefore, such iteration is more suitable for debugging purposes
@@ -71,8 +95,8 @@ namespace cds { namespace container {
         \par Usage
 
         You should decide what garbage collector you want, and what ordered list you want to use. Split-ordered list
-        is original data structure based on an ordered list. Suppose, you want construct split-list map based on cds::urcu::general_buffered<> GC
-        and MichaelList as ordered list implementation. Your map should map \p int key to <tt>std::string</tt> value.
+        is original data structure based on an ordered list. Suppose, you want construct split-list map based on \p cds::urcu::general_buffered<> GC
+        and \p MichaelList as ordered list implementation. Your map should map \p int key to \p std::string value.
         So, you beginning your program with following include:
         \code
         #include <cds/urcu/general_buffered.h>
@@ -83,26 +107,26 @@ namespace cds { namespace container {
         \endcode
         The inclusion order is important:
         - first, include one of \ref cds_urcu_gc "RCU implementation" (<tt>cds/urcu/general_buffered.h</tt> in our case)
-        - second, include file for ordered-list implementation (for this example, <tt>cds/container/michael_list_rcu.h</tt>),
+        - second, include the header of ordered-list implementation (for this example, <tt>cds/container/michael_list_rcu.h</tt>),
         - then, the header for RCU-based split-list map <tt>cds/container/split_list_map_rcu.h</tt>.
 
         Now, you should declare traits for split-list map. The main parts of traits are a hash functor for the map key and a comparing functor for ordered list.
-        We use <tt>std::hash<int></tt> as hash functor and <tt>std::less<int></tt> predicate as comparing functor.
+        We use \p std::hash<int> and \p std::less<int>.
 
-        The second attention: instead of using %MichaelList in %SplitListMap traits we use a tag <tt>cds::contaner::michael_list_tag</tt>
+        The second attention: instead of using \p %MichaelList in \p %SplitListMap traits we use a tag \p ds::contaner::michael_list_tag
         for the Michael's list.
         The split-list requires significant support from underlying ordered list class and it is not good idea to dive you
         into deep implementation details of split-list and ordered list interrelations. The tag paradigm simplifies split-list interface.
 
         \code
         // SplitListMap traits
-        struct foo_set_traits: public cc::split_list::type_traits
+        struct foo_set_traits: public cc::split_list::traits
         {
             typedef cc::michael_list_tag   ordered_list    ;   // what type of ordered list we want to use
             typedef std::hash<int>         hash            ;   // hash functor for the key stored in split-list map
 
             // Type traits for our MichaelList class
-            struct ordered_list_traits: public cc::michael_list::type_traits
+            struct ordered_list_traits: public cc::michael_list::traits
             {
                 typedef std::less<int> less   ;   // use our std::less predicate as comparator to order list nodes
             };
@@ -114,9 +138,9 @@ namespace cds { namespace container {
         typedef cc::SplitListMap< cds::urcu::gc<cds::urcu::general_buffered<> >, int, std::string, foo_set_traits > int_string_map;
         \endcode
 
-        You may use the modern option-based declaration instead of classic type-traits-based one:
+        You may use the modern option-based declaration instead of classic traits-based one:
         \code
-        typedef cc:SplitListMap<
+        typedef cc::SplitListMap<
             cds::urcu::gc<cds::urcu::general_buffered<> >  // RCU type
             ,int                    // key type
             ,std::string            // value type
@@ -131,21 +155,20 @@ namespace cds { namespace container {
             >::type
         >  int_string_map;
         \endcode
-        In case of option-based declaration using split_list::make_traits metafunction the struct \p foo_set_traits is not required.
+        In case of option-based declaration using \p split_list::make_traits metafunction the struct \p foo_set_traits is not required.
 
         Now, the map of type \p int_string_map is ready to use in your program.
 
-        Note that in this example we show only mandatory type_traits parts, optional ones is the default and they are inherited
-        from cds::container::split_list::type_traits.
-        The <b>cds</b> library contains many other options for deep tuning of behavior of the split-list and
-        ordered-list containers.
+        Note that in this example we show only mandatory \p traits parts, optional ones is the default and they are inherited
+        from cds::container::split_list::traits.
+        There are many other useful options for deep tuning the split-list and ordered-list containers.
     */
     template <
         class RCU,
         typename Key,
         typename Value,
 #ifdef CDS_DOXYGEN_INVOKED
-        class Traits = split_list::type_traits
+        class Traits = split_list::traits
 #else
         class Traits
 #endif
@@ -166,58 +189,28 @@ namespace cds { namespace container {
         //@endcond
 
     public:
-        typedef typename base_class::gc gc              ;   ///< Garbage collector
-        typedef Traits                  options         ;   ///< ]p Traits template argument
-        typedef Key                     key_type        ;   ///< key type
-        typedef Value                   mapped_type     ;   ///< type of value stored in the map
+        typedef cds::urcu::gc< RCU > gc; ///< Garbage collector
+        typedef Key     key_type;    ///< key type
+        typedef Value   mapped_type; ///< type of value to be stored in the map
+        typedef Traits  traits;     ///< Map traits
 
-        typedef std::pair<key_type const, mapped_type>  value_type  ;   ///< key-value pair type
-        typedef typename base_class::ordered_list       ordered_list;   ///< Underlying ordered list class
-        typedef typename base_class::key_comparator     key_comparator  ;   ///< key comparison functor
+        typedef std::pair<key_type const, mapped_type> value_type;     ///< key-value pair type
+        typedef typename base_class::ordered_list      ordered_list;   ///< Underlying ordered list class
+        typedef typename base_class::key_comparator    key_comparator; ///< key comparison functor
 
-        typedef typename base_class::hash           hash            ;   ///< Hash functor for \ref key_type
-        typedef typename base_class::item_counter   item_counter    ;   ///< Item counter type
+        typedef typename base_class::hash           hash;         ///< Hash functor for \ref key_type
+        typedef typename base_class::item_counter   item_counter; ///< Item counter type
+        typedef typename base_class::stat           stat;         ///< Internal statistics
 
-        typedef typename base_class::rcu_lock       rcu_lock    ; ///< RCU scoped lock
-        typedef typename base_class::exempt_ptr     exempt_ptr  ; ///< pointer to extracted node
+        typedef typename base_class::rcu_lock       rcu_lock;   ///< RCU scoped lock
+        typedef typename base_class::exempt_ptr     exempt_ptr; ///< pointer to extracted node
         /// Group of \p extract_xxx functions require external locking if underlying ordered list requires that
-        static CDS_CONSTEXPR_CONST bool c_bExtractLockExternal = base_class::c_bExtractLockExternal;
+        static CDS_CONSTEXPR const bool c_bExtractLockExternal = base_class::c_bExtractLockExternal;
+        typedef typename base_class::raw_ptr        raw_ptr;    ///< type of \p get() return value
 
     protected:
         //@cond
-        typedef typename base_class::maker::type_traits::key_accessor key_accessor;
-
-#   ifndef CDS_CXX11_LAMBDA_SUPPORT
-        template <typename Func>
-        class ensure_functor_wrapper: protected cds::details::functor_wrapper<Func>
-        {
-            typedef cds::details::functor_wrapper<Func> base_class;
-        public:
-            ensure_functor_wrapper() {}
-            ensure_functor_wrapper( Func f ): base_class(f) {}
-
-            template <typename Q>
-            void operator()( bool bNew, value_type& item, const Q& /*val*/ )
-            {
-                base_class::get()( bNew, item );
-            }
-        };
-
-        template <typename Func>
-        class find_functor_wrapper: protected cds::details::functor_wrapper<Func>
-        {
-            typedef cds::details::functor_wrapper<Func> base_class;
-        public:
-            find_functor_wrapper() {}
-            find_functor_wrapper( Func f ): base_class(f) {}
-
-            template <typename Q>
-            void operator()( value_type& pair, Q const& /*val*/ )
-            {
-                base_class::get()( pair );
-            }
-        };
-#   endif   // ifndef CDS_CXX11_LAMBDA_SUPPORT
+        typedef typename base_class::maker::traits::key_accessor key_accessor;
         //@endcond
 
     public:
@@ -253,7 +246,7 @@ namespace cds { namespace container {
         {
             return base_class::begin();
         }
-        const_iterator cbegin()
+        const_iterator cbegin() const
         {
             return base_class::cbegin();
         }
@@ -265,7 +258,7 @@ namespace cds { namespace container {
         {
             return base_class::end();
         }
-        const_iterator cend()
+        const_iterator cend() const
         {
             return base_class::cend();
         }
@@ -275,8 +268,8 @@ namespace cds { namespace container {
         /// Initializes split-ordered map of default capacity
         /**
             The default capacity is defined in bucket table constructor.
-            See intrusive::split_list::expandable_bucket_table, intrusive::split_list::static_bucket_table
-            which selects by intrusive::split_list::dynamic_bucket_table option.
+            See \p intrusive::split_list::expandable_bucket_table, \p intrusive::split_list::static_bucket_table
+            which selects by \p split_list::dynamic_bucket_table option.
         */
         SplitListMap()
             : base_class()
@@ -284,7 +277,7 @@ namespace cds { namespace container {
 
         /// Initializes split-ordered map
         SplitListMap(
-            size_t nItemCount           ///< estimate average item count
+            size_t nItemCount           ///< estimated average item count
             , size_t nLoadFactor = 1    ///< load factor - average item count per bucket. Small integer up to 10, default is 1.
             )
             : base_class( nItemCount, nLoadFactor )
@@ -293,12 +286,11 @@ namespace cds { namespace container {
     public:
         /// Inserts new node with key and default value
         /**
-            The function creates a node with \p key and default value, and then inserts the node created into the map.
+            The function creates a node with \p key and the default value, and then inserts the node created into the map.
 
             Preconditions:
-            - The \ref key_type should be constructible from value of type \p K.
-                In trivial case, \p K is equal to \ref key_type.
-            - The \ref mapped_type should be default-constructible.
+            - The \p key_type should be constructible from value of type \p K.
+            - The \p mapped_type should be default-constructible.
 
             The function applies RCU lock internally.
 
@@ -307,18 +299,17 @@ namespace cds { namespace container {
         template <typename K>
         bool insert( K const& key )
         {
-            //TODO: pass arguments by reference (make_pair makes copy)
-            return base_class::insert( std::make_pair( key, mapped_type() ) );
+            return base_class::emplace( key_type( key ), mapped_type());
         }
 
         /// Inserts new node
         /**
             The function creates a node with copy of \p val value
-            and then inserts the node created into the map.
+            and then inserts the node into the map.
 
             Preconditions:
-            - The \ref key_type should be constructible from \p key of type \p K.
-            - The \ref mapped_type should be constructible from \p val of type \p V.
+            - The \p key_type should be constructible from \p key of type \p K.
+            - The \p mapped_type should be constructible from \p val of type \p V.
 
             The function applies RCU lock internally.
 
@@ -328,7 +319,7 @@ namespace cds { namespace container {
         bool insert( K const& key, V const& val )
         {
             //TODO: pass arguments by reference (make_pair makes copy)
-            return base_class::insert( std::make_pair(key, val) );
+            return base_class::emplace( key_type( key ), mapped_type( val ));
         }
 
         /// Inserts new node and initialize it by a functor
@@ -346,14 +337,11 @@ namespace cds { namespace 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.
 
-            It should be keep in mind that concurrent modifications of \p <tt>item.second</tt> may be possible.
-            User-defined functor \p func should guarantee that during changing item's value no any other changes
+            It should be keep in mind that concurrent modifications of \p <tt>item.second</tt> in \p func body
+            should be careful. You shouldf guarantee that during changing item's value in \p func 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>
-            and it is called only if inserting is successful.
-
-            The key_type should be constructible from value of type \p K.
+            \p func is called only if inserting is successful.
 
             The function allows to split creating of new item into two part:
             - create item from \p key;
@@ -366,80 +354,77 @@ namespace cds { namespace container {
             The function applies RCU lock internally.
         */
         template <typename K, typename Func>
-        bool insert_key( K const& key, Func func )
+        bool insert_with( K const& key, Func func )
         {
             //TODO: pass arguments by reference (make_pair makes copy)
-            return base_class::insert( std::make_pair( key, mapped_type() ), func );
+            return base_class::insert( std::make_pair( key_type( key ), mapped_type()), func );
         }
 
-#   ifdef CDS_EMPLACE_SUPPORT
-        /// For key \p key inserts data of type \ref mapped_type constructed with <tt>std::forward<Args>(args)...</tt>
+        /// For key \p key inserts data of type \p mapped_type created in-place from \p args
         /**
             \p key_type should be constructible from type \p K
 
             The function applies RCU lock internally.
 
             Returns \p true if inserting successful, \p false otherwise.
-
-            @note This function is available only for compiler that supports
-            variadic template and move semantics
         */
         template <typename K, typename... Args>
         bool emplace( K&& key, Args&&... args )
         {
-            return base_class::emplace( std::forward<K>(key), std::move(mapped_type(std::forward<Args>(args)...)));
+            return base_class::emplace( key_type( std::forward<K>( key )), mapped_type( std::forward<Args>(args)... ));
         }
-#   endif
 
-        /// Ensures that the \p key exists in the map
+        /// Updates data by \p key
         /**
-            The operation performs inserting or changing data with lock-free manner.
+            The operation performs inserting or replacing the element with lock-free manner.
 
             If the \p key not found in the map, then the new item created from \p key
-            is inserted into the map (note that in this case the \ref key_type should be
-            constructible from type \p K).
-            Otherwise, the functor \p func is called with item found.
-            The functor \p Func may be a function with signature:
-            \code
-                void func( bool bNew, value_type& item );
-            \endcode
-            or a functor:
+            will be inserted into the map iff \p bAllowInsert is \p true.
+            (note that in this case the \ref key_type should be constructible from type \p K).
+            Otherwise, if \p key is found, the functor \p func is called with item found.
+
+            The functor \p Func signature is:
             \code
                 struct my_functor {
                     void operator()( bool bNew, value_type& item );
                 };
             \endcode
-
             with arguments:
             - \p bNew - \p true if the item has been inserted, \p false otherwise
-            - \p item - item of the list
+            - \p item - the item found or inserted
 
-            The functor may change any fields of the \p item.second that is \ref mapped_type;
-            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>.
+            The functor may change any fields of the \p item.second that is \p mapped_type.
 
             The function applies RCU lock internally.
 
-            Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successfull,
+            Returns <tt> std::pair<bool, bool> </tt> where \p first is true if operation is successful,
             \p second is true if new item has been added or \p false if the item with \p key
-            already is in the list.
+            already exists.
+
+            @warning For \ref cds_nonintrusive_MichaelKVList_gc "MichaelKVList" as the ordered list see \ref cds_intrusive_item_creating "insert item troubleshooting".
+            \ref cds_nonintrusive_LazyKVList_gc "LazyKVList" provides exclusive access to inserted item and does not require any node-level
+            synchronization.
         */
         template <typename K, typename Func>
-        std::pair<bool, bool> ensure( K const& key, Func func )
+        std::pair<bool, bool> update( K const& key, Func func, bool bAllowInsert = true )
         {
             //TODO: pass arguments by reference (make_pair makes copy)
-#   ifdef CDS_CXX11_LAMBDA_SUPPORT
-            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 );
-                } );
-#   else
-            ensure_functor_wrapper<Func> fw( func );
-            return base_class::ensure( std::make_pair( key, mapped_type() ), cds::ref(fw) );
-#   endif
+            typedef decltype( std::make_pair( key_type( key ), mapped_type())) arg_pair_type;
+
+            return base_class::update( std::make_pair( key_type( key ), mapped_type()),
+                [&func]( bool bNew, value_type& item, arg_pair_type const& /*val*/ ) {
+                    func( bNew, item );
+                },
+                bAllowInsert );
+        }
+        //@cond
+        template <typename K, typename Func>
+        CDS_DEPRECATED("ensure() is deprecated, use update()")
+        std::pair<bool, bool> ensure( K const& key, Func func )
+        {
+            return update( key, func, true );
         }
+        //@endcond
 
         /// Deletes \p key from the map
         /** \anchor cds_nonintrusive_SplitListMap_rcu_erase_val
@@ -464,7 +449,8 @@ namespace cds { namespace container {
         template <typename K, typename Less>
         bool erase_with( K const& key, Less pred )
         {
-            return base_class::erase_with( key, cds::details::predicate_wrapper<value_type, Less, key_accessor>() );
+            CDS_UNUSED( pred );
+            return base_class::erase_with( key, cds::details::predicate_wrapper<value_type, Less, key_accessor>());
         }
 
         /// Deletes \p key from the map
@@ -479,7 +465,6 @@ namespace cds { namespace container {
                 void operator()(value_type& item) { ... }
             };
             \endcode
-            The functor may be passed by reference using <tt>boost:ref</tt>
 
             RCU \p synchronize method can be called. RCU should not be locked.
 
@@ -501,39 +486,39 @@ namespace cds { namespace container {
         template <typename K, typename Less, typename Func>
         bool erase_with( K const& key, Less pred, Func f )
         {
+            CDS_UNUSED( pred );
             return base_class::erase_with( key, cds::details::predicate_wrapper<value_type, Less, key_accessor>(), f );
         }
 
         /// Extracts an item from the map
         /** \anchor cds_nonintrusive_SplitListMap_rcu_extract
             The function searches an item with key equal to \p key in the map,
-            unlinks it from the map, places item pointer into \p dest argument, and returns \p true.
-            If the item with the key equal to \p key is not found the function return \p false.
+            unlinks it from the map, and returns \ref cds::urcu::exempt_ptr "exempt_ptr" pointer to the item found.
+            If the item with the key equal to \p key is not found the function returns an empty \p exempt_ptr.
 
-            @note The function does NOT call RCU read-side lock or synchronization,
-            and does NOT dispose the item found. It just excludes the item from the map
-            and returns a pointer to item found.
-            You should lock RCU before calling of the function, and you should synchronize RCU
-            outside the RCU lock to free extracted item
+            Depends on ordered list you should or should not lock RCU before calling of this function:
+            - for the set based on \ref cds_intrusive_MichaelList_rcu "MichaelList" RCU should not be locked
+            - for the set based on \ref cds_intrusive_LazyList_rcu "LazyList" RCU should be locked
+            See ordered list implementation for details.
 
             \code
             typedef cds::urcu::gc< general_buffered<> > rcu;
+
+            // Split-list set based on MichaelList by default
             typedef cds::container::SplitListMap< rcu, int, Foo > splitlist_map;
 
             splitlist_map theMap;
             // ...
 
             typename splitlist_map::exempt_ptr p;
-            {
-                // first, we should lock RCU
-                typename splitlist_map::rcu_lock lock;
 
-                // Now, you can apply extract function
-                // Note that you must not delete the item found inside the RCU lock
-                if ( theMap.extract( p, 10 )) {
-                    // do something with p
-                    ...
-                }
+            // For MichaelList we should not lock RCU
+
+            // Now, you can apply extract function
+            p = theMap.extract( 10 )
+            if ( p ) {
+                // do something with p
+                ...
             }
 
             // We may safely release p here
@@ -542,22 +527,22 @@ namespace cds { namespace container {
             \endcode
         */
         template <typename K>
-        bool extract( exempt_ptr& dest, K const& key )
+        exempt_ptr extract( K const& key )
         {
-            return base_class::extract( dest, key );
+            return base_class::extract( key );
         }
 
         /// Extracts an item from the map using \p pred predicate for searching
         /**
-            The function is an analog of \ref cds_nonintrusive_SplitListMap_rcu_extract "extract(exempt_ptr&, K const&)"
-            but \p pred is used for key comparing.
+            The function is an analog of \p extract(K const&) but \p pred is used for key comparing.
             \p Less functor has the interface like \p std::less.
             \p pred must imply the same element order as the comparator used for building the map.
         */
         template <typename K, typename Less>
-        bool extract_with( exempt_ptr& dest, K const& key, Less pred )
+        exempt_ptr extract_with( K const& key, Less pred )
         {
-            return base_class::extract_with( dest, key, cds::details::predicate_wrapper<value_type, Less, key_accessor>());
+            CDS_UNUSED( pred );
+            return base_class::extract_with( key, cds::details::predicate_wrapper<value_type, Less, key_accessor>());
         }
 
         /// Finds the key \p key
@@ -572,8 +557,6 @@ namespace cds { namespace container {
             \endcode
             where \p item is the item found.
 
-            You may pass \p f argument by reference using <tt>boost::ref</tt> or cds::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.
             The functor does not serialize simultaneous access to the map's \p item. If such access is
@@ -586,12 +569,7 @@ namespace cds { namespace container {
         template <typename K, typename Func>
         bool find( K const& key, Func f )
         {
-#   ifdef CDS_CXX11_LAMBDA_SUPPORT
-            return base_class::find( key, [&f](value_type& pair, K const&){ cds::unref(f)( pair ); } );
-#   else
-            find_functor_wrapper<Func> fw(f);
-            return base_class::find( key, cds::ref(fw) );
-#   endif
+            return base_class::find( key, [&f](value_type& pair, K const&){ f( pair ); } );
         }
 
         /// Finds the key \p key using \p pred predicate for searching
@@ -604,47 +582,58 @@ namespace cds { namespace container {
         template <typename K, typename Less, typename Func>
         bool find_with( K const& key, Less pred, Func f )
         {
-#   ifdef CDS_CXX11_LAMBDA_SUPPORT
+            CDS_UNUSED( pred );
             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 ); } );
-#   else
-            find_functor_wrapper<Func> fw(f);
-            return base_class::find_with( key, cds::details::predicate_wrapper<value_type, Less, key_accessor>(), cds::ref(fw) );
-#   endif
+                [&f](value_type& pair, K const&){ f( pair ); } );
         }
 
-        /// Finds the key \p key
-        /** \anchor cds_nonintrusive_SplitListMap_rcu_find_val
-
+        /// Checks whether the map contains \p key
+        /**
             The function searches the item with key equal to \p key
             and returns \p true if it is found, and \p false otherwise.
 
             The function applies RCU lock internally.
         */
         template <typename K>
+        bool contains( K const& key )
+        {
+            return base_class::contains( key );
+        }
+        //@cond
+        template <typename K>
+        CDS_DEPRECATED("deprecated, use contains()")
         bool find( K const& key )
         {
             return base_class::find( key );
         }
+        //@endcond
 
-        /// Finds the key \p key using \p pred predicate for searching
+        /// Checks whether the map contains \p key using \p pred predicate for searching
         /**
-            The function is an analog of \ref cds_nonintrusive_SplitListMap_rcu_find_val "find(K const&)"
-            but \p pred is used for key comparing.
+            The function is an analog of <tt>contains( key )</tt> but \p pred is used for key comparing.
             \p Less functor has the interface like \p std::less.
             \p Less must imply the same element order as the comparator used for building the map.
         */
         template <typename K, typename Less>
+        bool contains( K const& key, Less pred )
+        {
+            CDS_UNUSED( pred );
+            return base_class::contains( key, cds::details::predicate_wrapper<value_type, Less, key_accessor>());
+        }
+        //@cond
+        template <typename K, typename Less>
+        CDS_DEPRECATED("deprecated, use contains()")
         bool find_with( K const& key, Less pred )
         {
-            return base_class::find_with( key, cds::details::predicate_wrapper<value_type, Less, key_accessor>() );
+            return contains( key, pred );
         }
+        //@endcond
 
         /// Finds \p key and return the item found
         /** \anchor cds_intrusive_SplitListMap_rcu_get
             The function searches the item with key equal to \p key and returns the pointer to item found.
-            If \p key is not found it returns \p nullptr.
+            If \p key is not found it returns empty \p raw_ptr.
 
             Note the compare functor should accept a parameter of type \p K that can be not the same as \p value_type.
 
@@ -659,7 +648,7 @@ namespace cds { namespace container {
                 // Lock RCU
                 typename splitlist_map::rcu_lock lock;
 
-                typename splitlist_map::value_type * pVal = theMap.get( 5 );
+                typename splitlist_map::raw_ptr pVal = theMap.get( 5 );
                 if ( pVal ) {
                     // Deal with pVal
                     //...
@@ -670,7 +659,7 @@ namespace cds { namespace container {
             \endcode
         */
         template <typename K>
-        value_type * get( K const& key )
+        raw_ptr get( K const& key )
         {
             return base_class::get( key );
         }
@@ -685,18 +674,13 @@ namespace cds { namespace container {
             \p pred must imply the same element order as the comparator used for building the map.
         */
         template <typename K, typename Less>
-        value_type * get_with( K const& key, Less pred )
+        raw_ptr get_with( K const& key, Less pred )
         {
+            CDS_UNUSED( pred );
             return base_class::get_with( key, cds::details::predicate_wrapper<value_type, Less, key_accessor>());
         }
 
-        /// Clears the map (non-atomic)
-        /**
-            The function unlink all items from the map.
-            The function is not atomic and not lock-free and should be used for debugging only.
-
-            RCU \p synchronize method can be called. RCU should not be locked.
-        */
+        /// Clears the map (not atomic)
         void clear()
         {
             base_class::clear();
@@ -717,9 +701,14 @@ namespace cds { namespace container {
         {
             return base_class::size();
         }
-    };
 
+        /// Returns internal statistics
+        stat const& statistics() const
+        {
+            return base_class::statistics();
+        }
+    };
 
 }} // namespace cds::container
 
-#endif // #ifndef __CDS_CONTAINER_SPLIT_LIST_MAP_RCU_H
+#endif // #ifndef CDSLIB_CONTAINER_SPLIT_LIST_MAP_RCU_H