From 40ba82b03f2eb6bdc16528577bdf209bb686584d Mon Sep 17 00:00:00 2001 From: khizmax Date: Mon, 24 Oct 2016 14:06:42 +0300 Subject: [PATCH] Changed algorithm of IterableList detecting Splitted up make_split_list_set.h file Added some tests for IterableList-derived classes --- cds/container/details/base.h | 10 + cds/container/details/iterable_list_base.h | 28 --- cds/container/details/make_split_list_set.h | 225 +----------------- .../details/make_split_list_set_lazy_list.h | 147 ++++++++++++ .../make_split_list_set_michael_list.h | 141 +++++++++++ cds/container/details/split_list_base.h | 2 + cds/intrusive/details/base.h | 10 +- cds/intrusive/details/iterable_list_base.h | 9 - cds/intrusive/impl/iterable_list.h | 3 + projects/Win/vc14/cds.vcxproj | 2 + projects/Win/vc14/cds.vcxproj.filters | 6 + .../intrusive-list/intrusive_iterable_hp.cpp | 18 ++ .../intrusive_michael_iterable_dhp.cpp | 21 ++ .../intrusive_michael_iterable_hp.cpp | 21 ++ .../intrusive_split_iterable_dhp.cpp | 21 ++ .../intrusive_split_iterable_hp.cpp | 21 ++ 16 files changed, 427 insertions(+), 258 deletions(-) create mode 100644 cds/container/details/make_split_list_set_lazy_list.h create mode 100644 cds/container/details/make_split_list_set_michael_list.h diff --git a/cds/container/details/base.h b/cds/container/details/base.h index 17acad69..6b9481a3 100644 --- a/cds/container/details/base.h +++ b/cds/container/details/base.h @@ -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 struct is_iterable_list: public cds::intrusive::is_iterable_list< List > diff --git a/cds/container/details/iterable_list_base.h b/cds/container/details/iterable_list_base.h index 621e0923..6df37916 100644 --- a/cds/container/details/iterable_list_base.h +++ b/cds/container/details/iterable_list_base.h @@ -148,34 +148,6 @@ namespace cds { namespace container { template 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 - struct is_iterable_list< IterableList> - { - enum { - value = true - }; - }; - - template - struct is_iterable_list< IterableKVList> - { - enum { - value = true - }; - }; - //@endcond - }} // namespace cds::container diff --git a/cds/container/details/make_split_list_set.h b/cds/container/details/make_split_list_set.h index bc1d4a13..5975f47f 100644 --- a/cds/container/details/make_split_list_set.h +++ b/cds/container/details/make_split_list_set.h @@ -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 - 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 > primary_node_type; - struct node_type: public primary_node_type - { - value_type m_Value; - - template - explicit node_type( Q const& v ) - : m_Value(v) - {} - template - explicit node_type( Q&& q, Args&&... args ) - : m_Value( std::forward(q), std::forward(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::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 - 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 - > 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 - 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 +#endif #ifdef CDSLIB_CONTAINER_DETAILS_LAZY_LIST_BASE_H - // if lazy_list included - template - 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 > primary_node_type; - struct node_type: public primary_node_type - { - value_type m_Value; - - template - explicit node_type( const Q& v ) - : m_Value(v) - {} - - template - explicit node_type( Q&& q, Args&&... args ) - : m_Value( std::forward(q), std::forward(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::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 - 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 - ,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 - 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 +#endif - } // namespace details -}} // namespace cds::container -//@endcond +#ifdef CDSLIB_CONTAINER_DETAILS_ITERABLE_LIST_BASE_H +# include +#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 index 00000000..f2fe26a4 --- /dev/null +++ b/cds/container/details/make_split_list_set_lazy_list.h @@ -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 + 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 > primary_node_type; + struct node_type: public primary_node_type + { + value_type m_Value; + + template + explicit node_type( const Q& v ) + : m_Value(v) + {} + + template + explicit node_type( Q&& q, Args&&... args ) + : m_Value( std::forward(q), std::forward(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::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 + 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 + ,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 + 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 index 00000000..14355074 --- /dev/null +++ b/cds/container/details/make_split_list_set_michael_list.h @@ -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 + 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 > primary_node_type; + struct node_type: public primary_node_type + { + value_type m_Value; + + template + explicit node_type( Q const& v ) + : m_Value(v) + {} + template + explicit node_type( Q&& q, Args&&... args ) + : m_Value( std::forward(q), std::forward(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::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 + 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 + > 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 + 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 diff --git a/cds/container/details/split_list_base.h b/cds/container/details/split_list_base.h index 38b4603c..9e4cfcef 100644 --- a/cds/container/details/split_list_base.h +++ b/cds/container/details/split_list_base.h @@ -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. diff --git a/cds/intrusive/details/base.h b/cds/intrusive/details/base.h index 4e2b156a..e088ac5a 100644 --- a/cds/intrusive/details/base.h +++ b/cds/intrusive/details/base.h @@ -325,12 +325,12 @@ namespace intrusive { */ //@cond + class iterable_list_tag + {}; + template - struct is_iterable_list { - enum { - value = false - }; - }; + struct is_iterable_list: public std::is_base_of< iterable_list_tag, List> + {}; //@endcond }} // namespace cds::intrusuve diff --git a/cds/intrusive/details/iterable_list_base.h b/cds/intrusive/details/iterable_list_base.h index 26625717..5fdce3ae 100644 --- a/cds/intrusive/details/iterable_list_base.h +++ b/cds/intrusive/details/iterable_list_base.h @@ -291,15 +291,6 @@ namespace cds { namespace intrusive { class IterableList; //@endcond - //@cond - template - struct is_iterable_list< IterableList< GC, T, Traits >> { - enum { - value = true - }; - }; - //@endcond - }} // namespace cds::intrusive #endif // #ifndef CDSLIB_INTRUSIVE_DETAILS_ITERABLE_LIST_BASE_H diff --git a/cds/intrusive/impl/iterable_list.h b/cds/intrusive/impl/iterable_list.h index a3d6e1d0..948ebc73 100644 --- a/cds/intrusive/impl/iterable_list.h +++ b/cds/intrusive/impl/iterable_list.h @@ -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 diff --git a/projects/Win/vc14/cds.vcxproj b/projects/Win/vc14/cds.vcxproj index 5b7e85c6..6f79741c 100644 --- a/projects/Win/vc14/cds.vcxproj +++ b/projects/Win/vc14/cds.vcxproj @@ -421,6 +421,8 @@ + + diff --git a/projects/Win/vc14/cds.vcxproj.filters b/projects/Win/vc14/cds.vcxproj.filters index 14f3e2ee..30c6b4b1 100644 --- a/projects/Win/vc14/cds.vcxproj.filters +++ b/projects/Win/vc14/cds.vcxproj.filters @@ -1285,5 +1285,11 @@ Header Files\cds\intrusive + + Header Files\cds\container\details + + + Header Files\cds\container\details + \ No newline at end of file diff --git a/test/unit/intrusive-list/intrusive_iterable_hp.cpp b/test/unit/intrusive-list/intrusive_iterable_hp.cpp index 1e253580..9d6380d4 100644 --- a/test/unit/intrusive-list/intrusive_iterable_hp.cpp +++ b/test/unit/intrusive-list/intrusive_iterable_hp.cpp @@ -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 diff --git a/test/unit/intrusive-set/intrusive_michael_iterable_dhp.cpp b/test/unit/intrusive-set/intrusive_michael_iterable_dhp.cpp index 19f14f8c..02632ff4 100644 --- a/test/unit/intrusive-set/intrusive_michael_iterable_dhp.cpp +++ b/test/unit/intrusive-set/intrusive_michael_iterable_dhp.cpp @@ -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 > + ,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 diff --git a/test/unit/intrusive-set/intrusive_michael_iterable_hp.cpp b/test/unit/intrusive-set/intrusive_michael_iterable_hp.cpp index 2554ceff..56bcdb08 100644 --- a/test/unit/intrusive-set/intrusive_michael_iterable_hp.cpp +++ b/test/unit/intrusive-set/intrusive_michael_iterable_hp.cpp @@ -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 > + ,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 diff --git a/test/unit/intrusive-set/intrusive_split_iterable_dhp.cpp b/test/unit/intrusive-set/intrusive_split_iterable_dhp.cpp index fe017628..211f9282 100644 --- a/test/unit/intrusive-set/intrusive_split_iterable_dhp.cpp +++ b/test/unit/intrusive-set/intrusive_split_iterable_dhp.cpp @@ -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 > + ,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 diff --git a/test/unit/intrusive-set/intrusive_split_iterable_hp.cpp b/test/unit/intrusive-set/intrusive_split_iterable_hp.cpp index b99e811c..7de3a039 100644 --- a/test/unit/intrusive-set/intrusive_split_iterable_hp.cpp +++ b/test/unit/intrusive-set/intrusive_split_iterable_hp.cpp @@ -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 > + ,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 -- 2.34.1