Changed algorithm of IterableList detecting
authorkhizmax <khizmax@gmail.com>
Mon, 24 Oct 2016 11:06:42 +0000 (14:06 +0300)
committerkhizmax <khizmax@gmail.com>
Mon, 24 Oct 2016 11:06:42 +0000 (14:06 +0300)
Splitted up make_split_list_set.h file
Added some tests for IterableList-derived classes

16 files changed:
cds/container/details/base.h
cds/container/details/iterable_list_base.h
cds/container/details/make_split_list_set.h
cds/container/details/make_split_list_set_lazy_list.h [new file with mode: 0644]
cds/container/details/make_split_list_set_michael_list.h [new file with mode: 0644]
cds/container/details/split_list_base.h
cds/intrusive/details/base.h
cds/intrusive/details/iterable_list_base.h
cds/intrusive/impl/iterable_list.h
projects/Win/vc14/cds.vcxproj
projects/Win/vc14/cds.vcxproj.filters
test/unit/intrusive-list/intrusive_iterable_hp.cpp
test/unit/intrusive-set/intrusive_michael_iterable_dhp.cpp
test/unit/intrusive-set/intrusive_michael_iterable_hp.cpp
test/unit/intrusive-set/intrusive_split_iterable_dhp.cpp
test/unit/intrusive-set/intrusive_split_iterable_hp.cpp

index 17acad69315b57f0bdaeb7def4f27be43049cee7..6b9481a3c0657090e37beb930410d357c6376c2b 100644 (file)
@@ -81,6 +81,16 @@ namespace container {
         @ingroup cds_nonintrusive_containers
     */
 
+
+    // Tag for selecting iterable list implementation
+    /** @ingroup cds_nonintrusive_helper
+        This struct is empty and it is used only as a tag for selecting \p IterableList
+        as ordered list implementation in declaration of some classes.
+
+        See \p split_list::traits::ordered_list as an example.
+    */
+    typedef intrusive::iterable_list_tag iterable_list_tag;
+
     //@cond
     template <typename List>
     struct is_iterable_list: public cds::intrusive::is_iterable_list< List >
index 621e0923508a473bb4643299d1ec1e27219b1cfb..6df379164a1227e34b4370c0bbc5bec65970741c 100644 (file)
@@ -148,34 +148,6 @@ namespace cds { namespace container {
     template <typename GC, typename Key, typename Value, typename Traits=iterable_list::traits>
     class IterableKVList;
 
-    // Tag for selecting iterable list implementation
-    /**
-        This struct is empty and it is used only as a tag for selecting \p IterableList
-        as ordered list implementation in declaration of some classes.
-
-        See \p split_list::traits::ordered_list as an example.
-    */
-    struct iterable_list_tag
-    {};
-
-    //@cond
-    template <typename GC, typename T, typename Traits>
-    struct is_iterable_list< IterableList<GC, T, Traits >>
-    {
-        enum {
-            value = true
-        };
-    };
-
-    template <typename GC, typename K, typename V, typename Traits>
-    struct is_iterable_list< IterableKVList<GC, K, V, Traits >>
-    {
-        enum {
-            value = true
-        };
-    };
-    //@endcond
-
 }}  // namespace cds::container
 
 
index bc1d4a1344d34de3abe91385c6fa6abd0f19d693..5975f47f14a07cfa85b204c7118c7f8644ed1cfd 100644 (file)
@@ -42,226 +42,19 @@ namespace cds { namespace container {
     struct michael_list_tag;
     struct lazy_list_tag;
 
-    namespace details {
+}} // namespace cds::container
 
-#ifdef CDSLIB_CONTAINER_DETAILS_MICHAEL_LIST_BASE_H
-        // if michael_list included
-
-        template <typename GC, typename T, typename Traits>
-        struct make_split_list_set< GC, T, michael_list_tag, Traits >
-        {
-            typedef GC      gc;
-            typedef T       value_type;
-            typedef Traits  original_traits;
-
-            typedef typename cds::opt::select_default<
-                typename original_traits::ordered_list_traits,
-                cds::container::michael_list::traits
-            >::type         original_ordered_list_traits;
-
-            typedef cds::intrusive::split_list::node< cds::intrusive::michael_list::node<gc> > primary_node_type;
-            struct node_type: public primary_node_type
-            {
-                value_type  m_Value;
-
-                template <typename Q>
-                explicit node_type( Q const& v )
-                    : m_Value(v)
-                {}
-                template <typename Q, typename... Args>
-                explicit node_type( Q&& q, Args&&... args )
-                    : m_Value( std::forward<Q>(q), std::forward<Args>(args)... )
-                {}
-
-                node_type() = delete;
-            };
-
-            typedef typename cds::opt::select_default<
-                typename original_traits::ordered_list_traits,
-                typename original_traits::allocator,
-                typename cds::opt::select_default<
-                    typename original_traits::ordered_list_traits::allocator,
-                    typename original_traits::allocator
-                >::type
-            >::type node_allocator_;
-
-            typedef typename node_allocator_::template rebind<node_type>::other node_allocator_type;
-
-            typedef cds::details::Allocator< node_type, node_allocator_type >   cxx_node_allocator;
-            struct node_deallocator
-            {
-                void operator ()( node_type * pNode )
-                {
-                    cxx_node_allocator().Delete( pNode );
-                }
-            };
 
-            typedef typename opt::details::make_comparator< value_type, original_ordered_list_traits >::type key_comparator;
-
-            typedef typename original_traits::key_accessor key_accessor;
-
-            struct value_accessor
-            {
-                typename key_accessor::key_type const& operator()( node_type const& node ) const
-                {
-                    return key_accessor()(node.m_Value);
-                }
-            };
-
-            template <typename Predicate>
-            struct predicate_wrapper {
-                typedef cds::details::predicate_wrapper< node_type, Predicate, value_accessor > type;
-            };
-
-            struct ordered_list_traits: public original_ordered_list_traits
-            {
-                typedef cds::intrusive::michael_list::base_hook<
-                    opt::gc<gc>
-                >   hook;
-                typedef cds::atomicity::empty_item_counter item_counter;
-                typedef node_deallocator  disposer;
-                typedef cds::details::compare_wrapper< node_type, key_comparator, value_accessor > compare;
-                static CDS_CONSTEXPR const opt::link_check_type link_checker = cds::intrusive::michael_list::traits::link_checker;
-            };
-
-            struct traits: public original_traits
-            {
-                struct hash: public original_traits::hash
-                {
-                    typedef typename original_traits::hash  base_class;
-
-                    size_t operator()(node_type const& v ) const
-                    {
-                        return base_class::operator()( key_accessor()( v.m_Value ) );
-                    }
-                    template <typename Q>
-                    size_t operator()( Q const& k ) const
-                    {
-                        return base_class::operator()( k );
-                    }
-                };
-            };
-
-            class ordered_list: public cds::intrusive::MichaelList< gc, node_type, ordered_list_traits >
-            {};
-            //typedef cds::intrusive::MichaelList< gc, node_type, ordered_list_traits > ordered_list;
-            typedef cds::intrusive::SplitListSet< gc, ordered_list, traits > type;
-        };
-#endif  // ifdef CDSLIB_CONTAINER_DETAILS_MICHAEL_LIST_BASE_H
+#ifdef CDSLIB_CONTAINER_DETAILS_MICHAEL_LIST_BASE_H
+#   include <cds/container/details/make_split_list_set_michael_list.h>
+#endif
 
 #ifdef CDSLIB_CONTAINER_DETAILS_LAZY_LIST_BASE_H
-        // if lazy_list included
-        template <typename GC, typename T, typename Traits>
-        struct make_split_list_set< GC, T, lazy_list_tag, Traits >
-        {
-            typedef GC      gc;
-            typedef T       value_type;
-            typedef Traits  original_traits;
-
-            typedef typename cds::opt::select_default<
-                typename original_traits::ordered_list_traits,
-                cds::container::lazy_list::traits
-            >::type         original_ordered_list_traits;
-
-            typedef typename cds::opt::select_default<
-                typename original_ordered_list_traits::lock_type,
-                typename cds::container::lazy_list::traits::lock_type
-            >::type   lock_type;
-
-            typedef cds::intrusive::split_list::node< cds::intrusive::lazy_list::node<gc, lock_type > > primary_node_type;
-            struct node_type: public primary_node_type
-            {
-                value_type  m_Value;
-
-                template <typename Q>
-                explicit node_type( const Q& v )
-                    : m_Value(v)
-                {}
-
-                template <typename Q, typename... Args>
-                explicit node_type( Q&& q, Args&&... args )
-                    : m_Value( std::forward<Q>(q), std::forward<Args>(args)... )
-                {}
-
-                node_type() = delete;
-            };
-
-            typedef typename cds::opt::select_default<
-                typename original_traits::ordered_list_traits,
-                typename original_traits::allocator,
-                typename cds::opt::select_default<
-                    typename original_traits::ordered_list_traits::allocator,
-                    typename original_traits::allocator
-                >::type
-            >::type node_allocator_;
-
-            typedef typename node_allocator_::template rebind<node_type>::other node_allocator_type;
-
-            typedef cds::details::Allocator< node_type, node_allocator_type >   cxx_node_allocator;
-            struct node_deallocator
-            {
-                void operator ()( node_type * pNode )
-                {
-                    cxx_node_allocator().Delete( pNode );
-                }
-            };
-
-            typedef typename opt::details::make_comparator< value_type, original_ordered_list_traits >::type key_comparator;
-
-            typedef typename original_traits::key_accessor key_accessor;
-
-            struct value_accessor
-            {
-                typename key_accessor::key_type const & operator()( node_type const & node ) const
-                {
-                    return key_accessor()(node.m_Value);
-                }
-            };
-
-            template <typename Predicate>
-            struct predicate_wrapper {
-                typedef cds::details::predicate_wrapper< node_type, Predicate, value_accessor > type;
-            };
-
-            struct ordered_list_traits: public original_ordered_list_traits
-            {
-                typedef cds::intrusive::lazy_list::base_hook<
-                    opt::gc<gc>
-                    ,opt::lock_type< lock_type >
-                >  hook;
-                typedef cds::atomicity::empty_item_counter item_counter;
-                typedef node_deallocator                disposer;
-                typedef cds::details::compare_wrapper< node_type, key_comparator, value_accessor > compare;
-                static CDS_CONSTEXPR const opt::link_check_type link_checker = cds::intrusive::lazy_list::traits::link_checker;
-            };
-
-            struct traits: public original_traits
-            {
-                struct hash: public original_traits::hash
-                {
-                    typedef typename original_traits::hash  base_class;
-
-                    size_t operator()(node_type const& v ) const
-                    {
-                        return base_class::operator()( key_accessor()( v.m_Value ));
-                    }
-                    template <typename Q>
-                    size_t operator()( Q const& k ) const
-                    {
-                        return base_class::operator()( k );
-                    }
-                };
-            };
-
-            class ordered_list: public cds::intrusive::LazyList< gc, node_type, ordered_list_traits >
-            {};
-            //typedef cds::intrusive::LazyList< gc, node_type, ordered_list_traits >  ordered_list;
-            typedef cds::intrusive::SplitListSet< gc, ordered_list, traits >   type;
-        };
-#endif  // ifdef CDSLIB_CONTAINER_DETAILS_LAZY_LIST_BASE_H
+#   include <cds/container/details/make_split_list_set_lazy_list.h>
+#endif
 
-    }   // namespace details
-}}  // namespace cds::container
-//@endcond
+#ifdef CDSLIB_CONTAINER_DETAILS_ITERABLE_LIST_BASE_H
+#   include <cds/container/details/make_split_list_set_iterable_list.h>
+#endif
 
 #endif // #ifndef CDSLIB_CONTAINER_DETAILS_MAKE_SPLIT_LIST_SET_H
diff --git a/cds/container/details/make_split_list_set_lazy_list.h b/cds/container/details/make_split_list_set_lazy_list.h
new file mode 100644 (file)
index 0000000..f2fe26a
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (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_DETAILS_MAKE_SPLIT_LIST_SET_LAZY_LIST_H
+#define CDSLIB_CONTAINER_DETAILS_MAKE_SPLIT_LIST_SET_LAZY_LIST_H
+
+//@cond
+namespace cds { namespace container { namespace details {
+
+    template <typename GC, typename T, typename Traits>
+    struct make_split_list_set< GC, T, lazy_list_tag, Traits >
+    {
+        typedef GC      gc;
+        typedef T       value_type;
+        typedef Traits  original_traits;
+
+        typedef typename cds::opt::select_default<
+            typename original_traits::ordered_list_traits,
+            cds::container::lazy_list::traits
+        >::type         original_ordered_list_traits;
+
+        typedef typename cds::opt::select_default<
+            typename original_ordered_list_traits::lock_type,
+            typename cds::container::lazy_list::traits::lock_type
+        >::type   lock_type;
+
+        typedef cds::intrusive::split_list::node< cds::intrusive::lazy_list::node<gc, lock_type > > primary_node_type;
+        struct node_type: public primary_node_type
+        {
+            value_type  m_Value;
+
+            template <typename Q>
+            explicit node_type( const Q& v )
+                : m_Value(v)
+            {}
+
+            template <typename Q, typename... Args>
+            explicit node_type( Q&& q, Args&&... args )
+                : m_Value( std::forward<Q>(q), std::forward<Args>(args)... )
+            {}
+
+            node_type() = delete;
+        };
+
+        typedef typename cds::opt::select_default<
+            typename original_traits::ordered_list_traits,
+            typename original_traits::allocator,
+            typename cds::opt::select_default<
+                typename original_traits::ordered_list_traits::allocator,
+                typename original_traits::allocator
+            >::type
+        >::type node_allocator_;
+
+        typedef typename node_allocator_::template rebind<node_type>::other node_allocator_type;
+
+        typedef cds::details::Allocator< node_type, node_allocator_type >   cxx_node_allocator;
+        struct node_deallocator
+        {
+            void operator ()( node_type * pNode )
+            {
+                cxx_node_allocator().Delete( pNode );
+            }
+        };
+
+        typedef typename opt::details::make_comparator< value_type, original_ordered_list_traits >::type key_comparator;
+
+        typedef typename original_traits::key_accessor key_accessor;
+
+        struct value_accessor
+        {
+            typename key_accessor::key_type const & operator()( node_type const & node ) const
+            {
+                return key_accessor()(node.m_Value);
+            }
+        };
+
+        template <typename Predicate>
+        struct predicate_wrapper {
+            typedef cds::details::predicate_wrapper< node_type, Predicate, value_accessor > type;
+        };
+
+        struct ordered_list_traits: public original_ordered_list_traits
+        {
+            typedef cds::intrusive::lazy_list::base_hook<
+                opt::gc<gc>
+                ,opt::lock_type< lock_type >
+            >  hook;
+            typedef cds::atomicity::empty_item_counter item_counter;
+            typedef node_deallocator                disposer;
+            typedef cds::details::compare_wrapper< node_type, key_comparator, value_accessor > compare;
+            static CDS_CONSTEXPR const opt::link_check_type link_checker = cds::intrusive::lazy_list::traits::link_checker;
+        };
+
+        struct traits: public original_traits
+        {
+            struct hash: public original_traits::hash
+            {
+                typedef typename original_traits::hash  base_class;
+
+                size_t operator()(node_type const& v ) const
+                {
+                    return base_class::operator()( key_accessor()( v.m_Value ));
+                }
+                template <typename Q>
+                size_t operator()( Q const& k ) const
+                {
+                    return base_class::operator()( k );
+                }
+            };
+        };
+
+        class ordered_list: public cds::intrusive::LazyList< gc, node_type, ordered_list_traits >
+        {};
+
+        typedef cds::intrusive::SplitListSet< gc, ordered_list, traits >   type;
+    };
+}}}  // namespace cds::container::details
+//@endcond
+
+#endif // #ifndef CDSLIB_CONTAINER_DETAILS_MAKE_SPLIT_LIST_SET_LAZY_LIST_H
diff --git a/cds/container/details/make_split_list_set_michael_list.h b/cds/container/details/make_split_list_set_michael_list.h
new file mode 100644 (file)
index 0000000..1435507
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+    This file is a part of libcds - Concurrent Data Structures library
+
+    (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_DETAILS_MAKE_SPLIT_LIST_SET_MICHAEL_LIST_H
+#define CDSLIB_CONTAINER_DETAILS_MAKE_SPLIT_LIST_SET_MICHAEL_LIST_H
+
+//@cond
+namespace cds { namespace container { namespace details {
+
+    template <typename GC, typename T, typename Traits>
+    struct make_split_list_set< GC, T, michael_list_tag, Traits >
+    {
+        typedef GC      gc;
+        typedef T       value_type;
+        typedef Traits  original_traits;
+
+        typedef typename cds::opt::select_default<
+            typename original_traits::ordered_list_traits,
+            cds::container::michael_list::traits
+        >::type         original_ordered_list_traits;
+
+        typedef cds::intrusive::split_list::node< cds::intrusive::michael_list::node<gc> > primary_node_type;
+        struct node_type: public primary_node_type
+        {
+            value_type  m_Value;
+
+            template <typename Q>
+            explicit node_type( Q const& v )
+                : m_Value(v)
+            {}
+            template <typename Q, typename... Args>
+            explicit node_type( Q&& q, Args&&... args )
+                : m_Value( std::forward<Q>(q), std::forward<Args>(args)... )
+            {}
+
+            node_type() = delete;
+        };
+
+        typedef typename cds::opt::select_default<
+            typename original_traits::ordered_list_traits,
+            typename original_traits::allocator,
+            typename cds::opt::select_default<
+                typename original_traits::ordered_list_traits::allocator,
+                typename original_traits::allocator
+            >::type
+        >::type node_allocator_;
+
+        typedef typename node_allocator_::template rebind<node_type>::other node_allocator_type;
+
+        typedef cds::details::Allocator< node_type, node_allocator_type >   cxx_node_allocator;
+        struct node_deallocator
+        {
+            void operator ()( node_type * pNode )
+            {
+                cxx_node_allocator().Delete( pNode );
+            }
+        };
+
+        typedef typename opt::details::make_comparator< value_type, original_ordered_list_traits >::type key_comparator;
+
+        typedef typename original_traits::key_accessor key_accessor;
+
+        struct value_accessor
+        {
+            typename key_accessor::key_type const& operator()( node_type const& node ) const
+            {
+                return key_accessor()(node.m_Value);
+            }
+        };
+
+        template <typename Predicate>
+        struct predicate_wrapper {
+            typedef cds::details::predicate_wrapper< node_type, Predicate, value_accessor > type;
+        };
+
+        struct ordered_list_traits: public original_ordered_list_traits
+        {
+            typedef cds::intrusive::michael_list::base_hook<
+                opt::gc<gc>
+            >   hook;
+            typedef cds::atomicity::empty_item_counter item_counter;
+            typedef node_deallocator  disposer;
+            typedef cds::details::compare_wrapper< node_type, key_comparator, value_accessor > compare;
+            static CDS_CONSTEXPR const opt::link_check_type link_checker = cds::intrusive::michael_list::traits::link_checker;
+        };
+
+        struct traits: public original_traits
+        {
+            struct hash: public original_traits::hash
+            {
+                typedef typename original_traits::hash  base_class;
+
+                size_t operator()(node_type const& v ) const
+                {
+                    return base_class::operator()( key_accessor()( v.m_Value ) );
+                }
+                template <typename Q>
+                size_t operator()( Q const& k ) const
+                {
+                    return base_class::operator()( k );
+                }
+            };
+        };
+
+        class ordered_list: public cds::intrusive::MichaelList< gc, node_type, ordered_list_traits >
+        {};
+
+        typedef cds::intrusive::SplitListSet< gc, ordered_list, traits > type;
+    };
+
+}}}  // namespace cds::container::details
+//@endcond
+
+#endif // #ifndef CDSLIB_CONTAINER_DETAILS_MAKE_SPLIT_LIST_SET_MICHAEL_LIST_H
index 38b4603c653d45139874c48229fbb91d99671ffc..9e4cfcef0b0e457f23fda85ec86940710ddc4af4 100644 (file)
@@ -119,6 +119,7 @@ namespace cds { namespace container {
                 Supported types are:
                 - \p michael_list_tag - for \p MichaelList
                 - \p lazy_list_tag - for \p LazyList
+                - \p iterable_list_tag - for \p IterableList
             */
             typedef michael_list_tag    ordered_list;
 
@@ -127,6 +128,7 @@ namespace cds { namespace container {
                 Specifyes traits for selected ordered list type, default type:
                 - for \p michael_list_tag: \p container::michael_list::traits.
                 - for \p lazy_list_tag: \p container::lazy_list::traits.
+                - for \p iterable_list_tag: \p container::iterable_list::traits.
 
                 If this type is \p opt::none, the ordered list traits is combined with default
                 ordered list traits and split-list traits.
index 4e2b156a269031691022b756240edb21158f1c09..e088ac5a8becc42d92c4fbed9b96d7f2cf2f389b 100644 (file)
@@ -325,12 +325,12 @@ namespace intrusive {
     */
 
     //@cond
+    class iterable_list_tag
+    {};
+
     template <typename List>
-    struct is_iterable_list {
-        enum {
-            value = false
-        };
-    };
+    struct is_iterable_list: public std::is_base_of< iterable_list_tag, List>
+    {};
     //@endcond
 
 }} // namespace cds::intrusuve
index 266257170d7ca6ecb5d30db223c0968478394e48..5fdce3ae95d41a206585116136fa22628a8ec5a0 100644 (file)
@@ -291,15 +291,6 @@ namespace cds { namespace intrusive {
     class IterableList;
     //@endcond
 
-    //@cond
-    template <typename GC, typename T, typename Traits>
-    struct is_iterable_list< IterableList< GC, T, Traits >> {
-        enum {
-            value = true
-        };
-    };
-    //@endcond
-
 }}   // namespace cds::intrusive
 
 #endif // #ifndef CDSLIB_INTRUSIVE_DETAILS_ITERABLE_LIST_BASE_H
index a3d6e1d0463efb528e1229e42fd5a270956d31a3..948ebc7379367e142aa39b4f8b01ec5fddc9f46a 100644 (file)
@@ -120,6 +120,9 @@ namespace cds { namespace intrusive {
 #endif
     >
     class IterableList
+#ifndef CDS_DOXYGEN_INVOKED
+        : public iterable_list_tag
+#endif
     {
     public:
         typedef T       value_type; ///< type of value stored in the list
index 5b7e85c6df268cafc0ffd7dc1f68a0f5dfa0bb11..6f79741c257f75aa2ce5563aeb48279b4129cd7c 100644 (file)
     <ClInclude Include="..\..\..\cds\container\details\make_skip_list_map.h" />\r
     <ClInclude Include="..\..\..\cds\container\details\make_skip_list_set.h" />\r
     <ClInclude Include="..\..\..\cds\container\details\make_split_list_set.h" />\r
+    <ClInclude Include="..\..\..\cds\container\details\make_split_list_set_lazy_list.h" />\r
+    <ClInclude Include="..\..\..\cds\container\details\make_split_list_set_michael_list.h" />\r
     <ClInclude Include="..\..\..\cds\container\details\michael_list_base.h" />\r
     <ClInclude Include="..\..\..\cds\container\details\michael_map_base.h" />\r
     <ClInclude Include="..\..\..\cds\container\details\michael_set_base.h" />\r
index 14f3e2eec6174dcff60dd5226abe03c1cd5d6715..30c6b4b1f0524d34d8ddce004330ddb7759499d0 100644 (file)
     <ClInclude Include="..\..\..\cds\intrusive\free_list_cached.h">\r
       <Filter>Header Files\cds\intrusive</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\..\..\cds\container\details\make_split_list_set_lazy_list.h">\r
+      <Filter>Header Files\cds\container\details</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\..\..\cds\container\details\make_split_list_set_michael_list.h">\r
+      <Filter>Header Files\cds\container\details</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file
index 1e253580149d3ebcd09a0719b9170c8119899960..9d6380d4bec5cf08a1badf8f74cbdc89a55f2fbe 100644 (file)
@@ -171,4 +171,22 @@ namespace {
         test_hp( l );
     }
 
+    TEST_F( IntrusiveIterableList_HP, derived )
+    {
+        class list_type: public ci::IterableList< gc_type, item_type,
+            typename ci::iterable_list::make_traits< 
+                ci::opt::disposer< mock_disposer >
+                ,cds::opt::less< less< item_type >>
+                ,cds::opt::item_counter< cds::atomicity::item_counter >
+
+            >::type 
+        >
+        {};
+
+       list_type l;
+       test_common( l );
+       test_ordered_iterator( l );
+       test_hp( l );
+    }
+
 } // namespace
index 19f14f8ca4ef6ecd50dc79c2f9a8b6fece67e2c5..02632ff40f235ea8ad4ab2009db1f79b2a796cdc 100644 (file)
@@ -167,4 +167,25 @@ namespace {
         EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
     }
 
+    TEST_F( IntrusiveMichaelIterableSet_DHP, derived_list )
+    {
+        class bucket_type: public ci::IterableList< gc_type
+            , item_type
+            ,ci::iterable_list::make_traits<
+                ci::opt::compare< cmp<item_type> >
+                ,ci::opt::disposer< mock_disposer >
+            >::type
+        >
+        {};
+
+        typedef ci::MichaelHashSet< gc_type, bucket_type,
+            ci::michael_set::make_traits<
+                ci::opt::hash< hash_int >
+            >::type
+        > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
 } // namespace
index 2554cefff81cbd15f77e39378ba13fe261119db2..56bcdb08e71af42a3cb6e48bcd265e3ceebfc8b9 100644 (file)
@@ -170,4 +170,25 @@ namespace {
         EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
     }
 
+    TEST_F( IntrusiveMichaelIterableSet_HP, derived_list )
+    {
+        class bucket_type: public ci::IterableList< gc_type
+            , item_type
+            , ci::iterable_list::make_traits<
+                ci::opt::compare< cmp<item_type> >
+                ,ci::opt::disposer< mock_disposer >
+            >::type
+        >
+        {};
+
+        typedef ci::MichaelHashSet< gc_type, bucket_type,
+            ci::michael_set::make_traits<
+            ci::opt::hash< hash_int >
+            >::type
+        > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
 } // namespace
index fe017628c1143e8b4c7ddacbde322acd22ad8d87..211f9282fb18d2e69a22b4d64fc5a4ca5a240b59 100644 (file)
@@ -240,4 +240,25 @@ namespace {
     }
 
 
+    TEST_F( IntrusiveSplitListIterableSet_DHP, bucket_type )
+    {
+        class bucket_type: public ci::IterableList< gc_type
+            , item_type
+            ,ci::iterable_list::make_traits<
+                ci::opt::compare< cmp<item_type> >
+                ,ci::opt::disposer< mock_disposer >
+            >::type
+        >
+        {};
+
+        typedef ci::SplitListSet< gc_type, bucket_type,
+            ci::split_list::make_traits<
+                ci::opt::hash< hash_int >
+            >::type
+        > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
 } // namespace
index b99e811c4fc506b695b6c9d48b5b5d659edcef2a..7de3a03970e18550ab008fdaf6438c7eff0d3a23 100644 (file)
@@ -240,5 +240,26 @@ namespace {
         EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
     }
 
+    TEST_F( IntrusiveSplitListIterableSet_HP, derived_list )
+    {
+        class bucket_type: public ci::IterableList< gc_type
+            , item_type
+            ,ci::iterable_list::make_traits<
+                ci::opt::compare< cmp<item_type> >
+                ,ci::opt::disposer< mock_disposer >
+            >::type
+        >
+        {};
+
+        typedef ci::SplitListSet< gc_type, bucket_type,
+            ci::split_list::make_traits<
+                ci::opt::hash< hash_int >
+            >::type
+        > set_type;
+
+        set_type s( kSize, 2 );
+        test( s );
+    }
+
 
 } // namespace