From 303ac69794b272ba1a3856c4d0048141913a34f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Thu, 25 Sep 2014 17:12:55 +0200 Subject: [PATCH] Replaced boost/move/move.hpp with a more lightweight boost/move/utility_core.hpp --- include/boost/intrusive/avl_set.hpp | 2 +- include/boost/intrusive/avltree.hpp | 2 +- include/boost/intrusive/bs_set.hpp | 2 +- include/boost/intrusive/bstree.hpp | 14 +- include/boost/intrusive/bstree_algorithms.hpp | 8 ++ .../boost/intrusive/detail/config_begin.hpp | 3 +- .../has_member_function_callable_with.hpp | 3 +- include/boost/intrusive/detail/utilities.hpp | 2 +- include/boost/intrusive/hashtable.hpp | 2 +- include/boost/intrusive/list.hpp | 3 +- include/boost/intrusive/rbtree.hpp | 2 +- include/boost/intrusive/set.hpp | 2 +- include/boost/intrusive/sg_set.hpp | 2 +- include/boost/intrusive/sgtree.hpp | 2 +- include/boost/intrusive/slist.hpp | 3 +- include/boost/intrusive/splay_set.hpp | 2 +- include/boost/intrusive/splaytree.hpp | 2 +- include/boost/intrusive/treap.hpp | 8 +- include/boost/intrusive/treap_set.hpp | 2 +- include/boost/intrusive/unordered_set.hpp | 2 +- test/container_size_test.cpp | 135 +++++++++--------- test/has_member_function_callable_with.cpp | 2 +- test/null_iterator_test.cpp | 2 - test/test_container.hpp | 2 +- 24 files changed, 115 insertions(+), 94 deletions(-) diff --git a/include/boost/intrusive/avl_set.hpp b/include/boost/intrusive/avl_set.hpp index 2d78b4d..0dc1e8d 100644 --- a/include/boost/intrusive/avl_set.hpp +++ b/include/boost/intrusive/avl_set.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include namespace boost { diff --git a/include/boost/intrusive/avltree.hpp b/include/boost/intrusive/avltree.hpp index ddc24f9..ebe78d3 100644 --- a/include/boost/intrusive/avltree.hpp +++ b/include/boost/intrusive/avltree.hpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include namespace boost { namespace intrusive { diff --git a/include/boost/intrusive/bs_set.hpp b/include/boost/intrusive/bs_set.hpp index f000f0e..0620b9a 100644 --- a/include/boost/intrusive/bs_set.hpp +++ b/include/boost/intrusive/bs_set.hpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include namespace boost { namespace intrusive { diff --git a/include/boost/intrusive/bstree.hpp b/include/boost/intrusive/bstree.hpp index 1b6ee5d..4e3a43b 100644 --- a/include/boost/intrusive/bstree.hpp +++ b/include/boost/intrusive/bstree.hpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include namespace boost { namespace intrusive { @@ -1853,6 +1853,12 @@ class bstree_impl node_algorithms::init(to_remove); } + //! Effects: Asserts the integrity of the container with additional checks provided by the user. + //! + //! Complexity: Linear time. + //! + //! Note: The method might not have effect when asserts are turned off (e.g., with NDEBUG). + //! Experimental function, interface might change in future versions. template void check(ExtraChecker extra_checker) const { @@ -1865,6 +1871,12 @@ class bstree_impl BOOST_INTRUSIVE_INVARIANT_ASSERT(this->sz_traits().get_size() == checker_return.node_count); } + //! Effects: Asserts the integrity of the container. + //! + //! Complexity: Linear time. + //! + //! Note: The method has no effect when asserts are turned off (e.g., with NDEBUG). + //! Experimental function, interface might change in future versions. void check() const { check(detail::empty_node_checker()); diff --git a/include/boost/intrusive/bstree_algorithms.hpp b/include/boost/intrusive/bstree_algorithms.hpp index cf7a0a0..befc232 100644 --- a/include/boost/intrusive/bstree_algorithms.hpp +++ b/include/boost/intrusive/bstree_algorithms.hpp @@ -1486,6 +1486,14 @@ class bstree_algorithms return new_root; } + //! Effects: Asserts the integrity of the container with additional checks provided by the user. + //! + //! Requires: header must be the header of a tree. + //! + //! Complexity: Linear time. + //! + //! Note: The method might not have effect when asserts are turned off (e.g., with NDEBUG). + //! Experimental function, interface might change in future versions. template static void check(const const_node_ptr& header, Checker checker, typename Checker::return_type& checker_return) { diff --git a/include/boost/intrusive/detail/config_begin.hpp b/include/boost/intrusive/detail/config_begin.hpp index 109a590..36d605d 100644 --- a/include/boost/intrusive/detail/config_begin.hpp +++ b/include/boost/intrusive/detail/config_begin.hpp @@ -10,8 +10,7 @@ // ///////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_INTRUSIVE_CONFIG_INCLUDED -#define BOOST_INTRUSIVE_CONFIG_INCLUDED +#ifndef BOOST_CONFIG_HPP #include #endif diff --git a/include/boost/intrusive/detail/has_member_function_callable_with.hpp b/include/boost/intrusive/detail/has_member_function_callable_with.hpp index 12eec96..9cd0779 100644 --- a/include/boost/intrusive/detail/has_member_function_callable_with.hpp +++ b/include/boost/intrusive/detail/has_member_function_callable_with.hpp @@ -19,8 +19,9 @@ #include #include #include + #include #include - #include + //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and //wrong SFINAE for GCC 4.2/4.3 diff --git a/include/boost/intrusive/detail/utilities.hpp b/include/boost/intrusive/detail/utilities.hpp index f51b45a..3aefbd7 100644 --- a/include/boost/intrusive/detail/utilities.hpp +++ b/include/boost/intrusive/detail/utilities.hpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/boost/intrusive/hashtable.hpp b/include/boost/intrusive/hashtable.hpp index eb46167..eead5e2 100644 --- a/include/boost/intrusive/hashtable.hpp +++ b/include/boost/intrusive/hashtable.hpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include namespace boost { namespace intrusive { diff --git a/include/boost/intrusive/list.hpp b/include/boost/intrusive/list.hpp index 5528523..2a0bae5 100644 --- a/include/boost/intrusive/list.hpp +++ b/include/boost/intrusive/list.hpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include namespace boost { namespace intrusive { @@ -1267,6 +1267,7 @@ class list_impl //! Complexity: Linear time. //! //! Note: The method has no effect when asserts are turned off (e.g., with NDEBUG). + //! Experimental function, interface might change in future versions. void check() const { const_node_ptr header_ptr = get_root_node(); diff --git a/include/boost/intrusive/rbtree.hpp b/include/boost/intrusive/rbtree.hpp index 20f719c..97bae9a 100644 --- a/include/boost/intrusive/rbtree.hpp +++ b/include/boost/intrusive/rbtree.hpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include namespace boost { namespace intrusive { diff --git a/include/boost/intrusive/set.hpp b/include/boost/intrusive/set.hpp index 9619e98..7d89cd9 100644 --- a/include/boost/intrusive/set.hpp +++ b/include/boost/intrusive/set.hpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include namespace boost { namespace intrusive { diff --git a/include/boost/intrusive/sg_set.hpp b/include/boost/intrusive/sg_set.hpp index 0ed2e02..46fba04 100644 --- a/include/boost/intrusive/sg_set.hpp +++ b/include/boost/intrusive/sg_set.hpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include namespace boost { namespace intrusive { diff --git a/include/boost/intrusive/sgtree.hpp b/include/boost/intrusive/sgtree.hpp index cd4d8bc..e0e9807 100644 --- a/include/boost/intrusive/sgtree.hpp +++ b/include/boost/intrusive/sgtree.hpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include namespace boost { namespace intrusive { diff --git a/include/boost/intrusive/slist.hpp b/include/boost/intrusive/slist.hpp index 35ca76a..df98047 100644 --- a/include/boost/intrusive/slist.hpp +++ b/include/boost/intrusive/slist.hpp @@ -31,7 +31,7 @@ #include #include //std::size_t #include //std::pair -#include +#include namespace boost { namespace intrusive { @@ -1843,6 +1843,7 @@ class slist_impl //! Complexity: Linear time. //! //! Note: The method has no effect when asserts are turned off (e.g., with NDEBUG). + //! Experimental function, interface might change in future versions. void check() const { const_node_ptr header_ptr = get_root_node(); diff --git a/include/boost/intrusive/splay_set.hpp b/include/boost/intrusive/splay_set.hpp index ee91679..2df3f95 100644 --- a/include/boost/intrusive/splay_set.hpp +++ b/include/boost/intrusive/splay_set.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include namespace boost { diff --git a/include/boost/intrusive/splaytree.hpp b/include/boost/intrusive/splaytree.hpp index a925b68..7856b8b 100644 --- a/include/boost/intrusive/splaytree.hpp +++ b/include/boost/intrusive/splaytree.hpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include namespace boost { namespace intrusive { diff --git a/include/boost/intrusive/treap.hpp b/include/boost/intrusive/treap.hpp index 7170e45..5fafdef 100644 --- a/include/boost/intrusive/treap.hpp +++ b/include/boost/intrusive/treap.hpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include namespace boost { @@ -904,6 +904,7 @@ class treap_impl this->tree_type::sz_traits().set_size(0); } + //! @copydoc ::boost::intrusive::bstree::check(ExtraChecker)const template void check(ExtraChecker extra_checker) const { @@ -912,10 +913,9 @@ class treap_impl tree_type::check(detail::treap_node_extra_checker(nodeptr_prio_comp, extra_checker)); } + //! @copydoc ::boost::intrusive::bstree::check()const void check() const - { - check(detail::empty_node_checker()); - } + { check(detail::empty_node_checker()); } #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED //! @copydoc ::boost::intrusive::bstree::count(const_reference)const diff --git a/include/boost/intrusive/treap_set.hpp b/include/boost/intrusive/treap_set.hpp index 6d75578..8514441 100644 --- a/include/boost/intrusive/treap_set.hpp +++ b/include/boost/intrusive/treap_set.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include namespace boost { diff --git a/include/boost/intrusive/unordered_set.hpp b/include/boost/intrusive/unordered_set.hpp index f91fc76..abb74eb 100644 --- a/include/boost/intrusive/unordered_set.hpp +++ b/include/boost/intrusive/unordered_set.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include diff --git a/test/container_size_test.cpp b/test/container_size_test.cpp index 00ad27f..5b3343b 100644 --- a/test/container_size_test.cpp +++ b/test/container_size_test.cpp @@ -27,6 +27,9 @@ using namespace boost::intrusive; +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(reverse_iterator) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_reverse_iterator) + template struct boolean { @@ -51,161 +54,159 @@ void test_sizes(boolean, std::size_t) {} template -void test_iterator_sizes(C &, std::size_t size) +void test_iterator_sizes(std::size_t size) { - typedef typename C::iterator iterator; - typedef typename C::const_iterator const_iterator; + typedef typename C::iterator iterator; + typedef typename C::const_iterator const_iterator; + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT + (::, C, reverse_iterator, iterator) reverse_iterator; + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT + (::, C, const_reverse_iterator, const_iterator) const_reverse_iterator; + BOOST_TEST_EQ(sizeof(iterator), size); BOOST_TEST_EQ(sizeof(const_iterator), size); + BOOST_TEST_EQ(sizeof(iterator), sizeof(reverse_iterator)); + BOOST_TEST_EQ(sizeof(const_iterator), size); + BOOST_TEST_EQ(sizeof(const_iterator), sizeof(const_reverse_iterator)); } //Test sizes for common 32 and 64 bit architectures void test_sizes(boolean, std::size_t wordsize) { { //list - list > > > c; + typedef list > > c; BOOST_TEST_EQ(sizeof(c), wordsize*3); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - list > >, constant_time_size > c; + typedef list >, constant_time_size > c; BOOST_TEST_EQ(sizeof(c), wordsize*2); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - list< node< list_base_hook<> >, header_holder_type< pointer_holder< list_node > > > c; + typedef list< node< list_base_hook<> >, header_holder_type< pointer_holder< list_node > > > c; BOOST_TEST_EQ(sizeof(c), wordsize*2); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - list< node< list_base_hook<> >, constant_time_size, header_holder_type< pointer_holder< list_node > > > c; + typedef list< node< list_base_hook<> >, constant_time_size, header_holder_type< pointer_holder< list_node > > > c; BOOST_TEST_EQ(sizeof(c), wordsize*1); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { //slist - slist > > > c; + typedef slist > > c; BOOST_TEST_EQ(sizeof(c), wordsize*2); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - slist > > , constant_time_size > c; + typedef slist >, constant_time_size > c; BOOST_TEST_EQ(sizeof(c), wordsize*1); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - slist > > , cache_last > c; + typedef slist >, cache_last > c; BOOST_TEST_EQ(sizeof(c), wordsize*3); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { //set - set > > > c; + typedef set > > c; BOOST_TEST_EQ(sizeof(c), wordsize*5); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - set > > , constant_time_size > c; + typedef set > , constant_time_size > c; BOOST_TEST_EQ(sizeof(c), wordsize*4); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - set > > > , constant_time_size > c; + typedef set > > , constant_time_size > c; BOOST_TEST_EQ(sizeof(c), wordsize*3); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - set< node< set_base_hook<> >, header_holder_type< pointer_holder< rbtree_node > > > c; + typedef set< node< set_base_hook<> >, header_holder_type< pointer_holder< rbtree_node > > > c; BOOST_TEST_EQ(sizeof(c), wordsize*2); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - set< node< set_base_hook<> >, constant_time_size, header_holder_type< pointer_holder< rbtree_node > > > c; + typedef set< node< set_base_hook<> >, constant_time_size, header_holder_type< pointer_holder< rbtree_node > > > c; BOOST_TEST_EQ(sizeof(c), wordsize*1); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { //avl - avl_set > > > c; + typedef avl_set > > c; BOOST_TEST_EQ(sizeof(c), wordsize*5); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - avl_set > > , constant_time_size > c; + typedef avl_set > , constant_time_size > c; BOOST_TEST_EQ(sizeof(c), wordsize*4); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - avl_set > > > , constant_time_size > c; + typedef avl_set > > , constant_time_size > c; BOOST_TEST_EQ(sizeof(c), wordsize*3); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - avl_set< node< avl_set_base_hook<> >, header_holder_type< pointer_holder< avltree_node > > > c; + typedef avl_set< node< avl_set_base_hook<> >, header_holder_type< pointer_holder< avltree_node > > > c; BOOST_TEST_EQ(sizeof(c), wordsize*2); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - avl_set< node< avl_set_base_hook<> >, constant_time_size, header_holder_type< pointer_holder< avltree_node > > > c; + typedef avl_set< node< avl_set_base_hook<> >, constant_time_size, header_holder_type< pointer_holder< avltree_node > > > c; BOOST_TEST_EQ(sizeof(c), wordsize*1); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { //splay - splay_set > > > c; + typedef splay_set > > c; BOOST_TEST_EQ(sizeof(c), wordsize*4); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - splay_set > > , constant_time_size > c; + typedef splay_set > , constant_time_size > c; BOOST_TEST_EQ(sizeof(c), wordsize*3); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { //scapegoat - sg_set > > c; + typedef sg_set > > c; BOOST_TEST_EQ(sizeof(c), (wordsize*5+sizeof(float)*2)); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { //treap - treap_set > > c; + typedef treap_set > > c; BOOST_TEST_EQ(sizeof(c), wordsize*4); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { - treap_set > , constant_time_size > c; + typedef treap_set > , constant_time_size > c; BOOST_TEST_EQ(sizeof(c), wordsize*3); - test_iterator_sizes(c, wordsize); + test_iterator_sizes(wordsize); } { //unordered - typedef unordered_set > > cont_type; - cont_type::bucket_type buckets[1]; - cont_type c(cont_type::bucket_traits(buckets, 1)); + typedef unordered_set > > c; BOOST_TEST_EQ(sizeof(c), wordsize*3); - test_iterator_sizes(c, wordsize*2); + test_iterator_sizes(wordsize*2); } { - typedef unordered_set > , power_2_buckets > cont_type; - cont_type::bucket_type buckets[1]; - cont_type c(cont_type::bucket_traits(buckets, 1)); + typedef unordered_set > , power_2_buckets > c; BOOST_TEST_EQ(sizeof(c), wordsize*3); - test_iterator_sizes(c, wordsize*2); + test_iterator_sizes(wordsize*2); } { - typedef unordered_set >, constant_time_size > cont_type; - cont_type::bucket_type buckets[1]; - cont_type c(cont_type::bucket_traits(buckets, 1)); + typedef unordered_set >, constant_time_size > c; BOOST_TEST_EQ(sizeof(c), wordsize*2); - test_iterator_sizes(c, wordsize*2); + test_iterator_sizes(wordsize*2); } { - typedef unordered_set > >, constant_time_size > cont_type; - cont_type::bucket_type buckets[1]; - cont_type c(cont_type::bucket_traits(buckets, 1)); + typedef unordered_set > >, constant_time_size > c; BOOST_TEST_EQ(sizeof(c), wordsize*2); - test_iterator_sizes(c, wordsize*2); + test_iterator_sizes(wordsize*2); } { - typedef unordered_set > >, incremental > cont_type; - cont_type::bucket_type buckets[1]; - cont_type c(cont_type::bucket_traits(buckets, 1)); + typedef unordered_set > >, incremental > c; BOOST_TEST_EQ(sizeof(c), wordsize*4); - test_iterator_sizes(c, wordsize*2); + test_iterator_sizes(wordsize*2); } } diff --git a/test/has_member_function_callable_with.cpp b/test/has_member_function_callable_with.cpp index 7839bf9..36d3620 100644 --- a/test/has_member_function_callable_with.cpp +++ b/test/has_member_function_callable_with.cpp @@ -13,7 +13,7 @@ //Just for BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED #include #include -#include +#include namespace boost{ namespace intrusive{ diff --git a/test/null_iterator_test.cpp b/test/null_iterator_test.cpp index 98a3307..72a68f2 100644 --- a/test/null_iterator_test.cpp +++ b/test/null_iterator_test.cpp @@ -26,8 +26,6 @@ using namespace boost::intrusive; - -#include struct Type : list_base_hook<> , slist_base_hook<> diff --git a/test/test_container.hpp b/test/test_container.hpp index 850ab5d..f44335b 100644 --- a/test/test_container.hpp +++ b/test/test_container.hpp @@ -15,7 +15,7 @@ #include #include -#include +#include namespace boost { namespace intrusive {