From f8058deb77f2800e0d536fcdb3c81a2b99627137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sun, 9 Apr 2017 22:09:51 +0200 Subject: [PATCH 1/9] Fix Trac ticket #12762: "Incorrect documentation for boost::intrusive::size_type" --- doc/intrusive.qbk | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/doc/intrusive.qbk b/doc/intrusive.qbk index 88dfc50..24b095b 100644 --- a/doc/intrusive.qbk +++ b/doc/intrusive.qbk @@ -331,7 +331,7 @@ and optionally, the user can specify options. We have 3 option types: containers can have a `size_type` that might be different from `std::size_t` (for example, STL-like containers use the `size_type` defined by their allocator). [*Boost.Intrusive] can be used to implement such containers specifying the - the type of the size. By default the type is `std::size_t`. + type of the size. By default the type is `std::size_t`. Example of a constant-time size intrusive list that will store Foo objects, using the base hook with the default tag: @@ -863,7 +863,7 @@ the section [link intrusive.usage How to use Boost.Intrusive]: * [*`constant_time_size`]: To activate the constant-time `size()` operation. Default: `constant_time_size` -* [*`size_type`]: To specify the type that will be used to store the size +* [*`size_type`]: To specify the type that will be used to store the size of the container. Default: `size_type`. [classref boost::intrusive::slist slist] can receive additional options: @@ -965,7 +965,7 @@ the section [link intrusive.usage How to use Boost.Intrusive]: * [*`constant_time_size`]: To activate the constant-time `size()` operation. Default: `constant_time_size` -* [*`size_type`]: To specify the type that will be used to store the size +* [*`size_type`]: To specify the type that will be used to store the size of the container. Default: `size_type` [endsect] @@ -1089,7 +1089,7 @@ These containers receive the same options explained in the section * [*`constant_time_size`]: To activate the constant-time `size()` operation. Default: `constant_time_size` -* [*`size_type`]: To specify the type that will be used to store the size +* [*`size_type`]: To specify the type that will be used to store the size of the container. Default: `size_type` And they also can receive an additional option: @@ -1279,7 +1279,7 @@ receive the same options explained in the section * [*`constant_time_size`]: To activate the constant-time `size()` operation. Default: `constant_time_size` -* [*`size_type`]: To specify the type that will be used to store the size +* [*`size_type`]: To specify the type that will be used to store the size of the container. Default: `size_type` And they also can receive additional options: @@ -1511,7 +1511,7 @@ These containers receive the same options explained in the section * [*`constant_time_size`]: To activate the constant-time `size()` operation. Default: `constant_time_size` -* [*`size_type`]: To specify the type that will be used to store the size +* [*`size_type`]: To specify the type that will be used to store the size of the container. Default: `size_type` And they also can receive an additional option: @@ -1613,7 +1613,7 @@ These containers receive the same options explained in the section * [*`constant_time_size`]: To activate the constant-time `size()` operation. Default: `constant_time_size` -* [*`size_type`]: To specify the type that will be used to store the size +* [*`size_type`]: To specify the type that will be used to store the size of the container. Default: `size_type` And they also can receive an additional option: @@ -1724,7 +1724,7 @@ These containers receive the same options explained in the section to configure the container. (To learn about value traits go to the section [link intrusive.value_traits Containers with custom ValueTraits].) -* [*`size_type`]: To specify the type that will be used to store the size +* [*`size_type`]: To specify the type that will be used to store the size of the container. Default: `size_type` And they also can receive additional options: @@ -1827,7 +1827,7 @@ These containers receive the same options explained in the section * [*`constant_time_size`]: To activate the constant-time `size()` operation. Default: `constant_time_size` -* [*`size_type`]: To specify the type that will be used to store the size +* [*`size_type`]: To specify the type that will be used to store the size of the container. Default: `size_type` And they also can receive additional options: @@ -3865,6 +3865,13 @@ to be inserted in intrusive containers are allocated using `std::vector` or `std [section:release_notes Release Notes] +[section:release_notes_boost_1_65_00 Boost 1.65 Release] + +* Fixed bugs: + * [@https://svn.boost.org/trac/boost/ticket/12894 Boost Trac #12894: ['Allow non std::size_t size_type]] + +[endsect] + [section:release_notes_boost_1_64_00 Boost 1.64 Release] * Fixed bugs: From 3e8c6619817571023d493a5dd194509ee7e52b6d Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 4 Apr 2017 15:45:11 +0300 Subject: [PATCH 2/9] Fix a typo in the docs --- include/boost/intrusive/slist.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/intrusive/slist.hpp b/include/boost/intrusive/slist.hpp index 0020699..f34350d 100644 --- a/include/boost/intrusive/slist.hpp +++ b/include/boost/intrusive/slist.hpp @@ -1115,7 +1115,7 @@ class slist_impl //! //! Throws: Nothing. //! - //! Complexity: Lineal to the elements (l - before_f + 1). + //! Complexity: Linear to the elements (l - before_f + 1). //! //! Note: Invalidates the iterators to the erased element. template From e6830cfe4c5db4fb279866439d02d03ae5407603 Mon Sep 17 00:00:00 2001 From: slymz Date: Tue, 27 Dec 2016 17:04:39 -0500 Subject: [PATCH 3/9] Update intrusive.qbk Minor but subtle (for beginners) correction. --- doc/intrusive.qbk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/intrusive.qbk b/doc/intrusive.qbk index 24b095b..82e4e8d 100644 --- a/doc/intrusive.qbk +++ b/doc/intrusive.qbk @@ -701,7 +701,7 @@ with the name of the file to include: These hooks have exactly the same size overhead as their analog non auto-unlinking hooks, but they have a restriction: they can only be used with -[link intrusive.presenting_containers non-constant time containers]. +[link intrusive.presenting_containers non-constant time size containers]. There is a reason for this: * Auto-unlink hooks don't store any reference to the container where they are inserted. From af8aa1956a7ecc378216a98b8ca860e5353a48a0 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 2 Nov 2017 14:30:33 +0200 Subject: [PATCH 4/9] Add .travis.yml --- .travis.yml | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b6b5798 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,57 @@ +# Copyright 2016, 2017 Peter Dimov +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + +language: cpp + +sudo: false + +python: "2.7" + +branches: + only: + - master + - develop + - /feature\/.*/ + +env: + matrix: + - BOGUS_JOB=true + +matrix: + + exclude: + - env: BOGUS_JOB=true + + include: + - os: linux + compiler: g++ + env: TOOLSET=gcc CXXSTD=03,11 + + - os: linux + compiler: clang++ + env: TOOLSET=clang CXXSTD=03,11,14,1z + + - os: osx + compiler: clang++ + env: TOOLSET=clang CXXSTD=03,11,14,1z + +install: + - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true + - cd .. + - git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root + - cd boost-root + - git submodule update --init tools/build + - git submodule update --init libs/config + - git submodule update --init tools/boostdep + - cp -r $TRAVIS_BUILD_DIR/* libs/intrusive + - python tools/boostdep/depinst/depinst.py intrusive + - ./bootstrap.sh + - ./b2 headers + +script: + - ./b2 libs/intrusive/test toolset=$TOOLSET cxxstd=$CXXSTD + +notifications: + email: + on_success: always From 50e7b7686c785687bc7021acab845a773a778169 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 2 Nov 2017 18:38:16 +0200 Subject: [PATCH 5/9] Update clang to libstdc++4.9 to fix ::gets error --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index b6b5798..f03b44d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,11 @@ matrix: - os: linux compiler: clang++ env: TOOLSET=clang CXXSTD=03,11,14,1z + apt: + packages: + - libstdc++-4.9-dev + sources: + - ubuntu-toolchain-r-test - os: osx compiler: clang++ From 15500ebba10be1b6b1c09a1c3792aeb11dd10340 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 2 Nov 2017 18:48:57 +0200 Subject: [PATCH 6/9] Add missing addons: line --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index f03b44d..2144c95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,7 @@ matrix: - os: linux compiler: clang++ env: TOOLSET=clang CXXSTD=03,11,14,1z + addons: apt: packages: - libstdc++-4.9-dev From 33dc4890b707d46de356835cb0c51761172d73dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 7 Nov 2017 00:39:33 +0100 Subject: [PATCH 7/9] Avoid using external reference in loop to avoid aliasing pesimization. --- include/boost/intrusive/hashtable.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/boost/intrusive/hashtable.hpp b/include/boost/intrusive/hashtable.hpp index 6b1d5dd..58ccfa9 100644 --- a/include/boost/intrusive/hashtable.hpp +++ b/include/boost/intrusive/hashtable.hpp @@ -3370,7 +3370,7 @@ class hashtable_impl , size_type &found_bucket , size_type &cnt) const { - cnt = 0; + size_type internal_cnt = 0; //Let's see if the element is present siterator prev; @@ -3386,20 +3386,21 @@ class hashtable_impl //the same bucket bucket_type &b = this->priv_bucket_pointer()[n_bucket]; siterator it = to_return.first; - ++cnt; //At least one is found + ++internal_cnt; //At least one is found if(optimize_multikey){ to_return.second = ++(priv_last_in_group)(it); - cnt += boost::intrusive::iterator_distance(++it, to_return.second); + internal_cnt += boost::intrusive::iterator_distance(++it, to_return.second); } else{ siterator const bend = b.end(); while(++it != bend && this->priv_is_value_equal_to_key(this->priv_value_from_slist_node(it.pointed_node()), h, key, equal_func)){ - ++cnt; + ++internal_cnt; } to_return.second = it; } } + cnt = internal_cnt; return to_return; } From 9ed0cdd90347bf28e05835ceb349f413cd4503a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 7 Nov 2017 00:39:53 +0100 Subject: [PATCH 8/9] Use intrusive's type traits instead of container's traits --- test/iterator_test.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/iterator_test.hpp b/test/iterator_test.hpp index 02f1ddc..486cdd8 100644 --- a/test/iterator_test.hpp +++ b/test/iterator_test.hpp @@ -120,8 +120,8 @@ void test_iterator_compatible(C &c) test_iterator_operations(get_reverse_iterator::begin(c), get_reverse_iterator::end(c)); test_iterator_operations(get_const_reverse_iterator::begin(c), get_const_reverse_iterator::end(c)); //Make sure dangeous conversions are not possible - BOOST_STATIC_ASSERT((!boost::container::container_detail::is_convertible::value)); - BOOST_STATIC_ASSERT((!boost::container::container_detail::is_convertible::value)); + BOOST_STATIC_ASSERT((!boost::intrusive::detail::is_convertible::value)); + BOOST_STATIC_ASSERT((!boost::intrusive::detail::is_convertible::value)); //Test iterator conversions { const_iterator ci; @@ -318,7 +318,7 @@ void test_iterator_forward(C &c) typedef iterator_traits rnit_traits; typedef iterator_traits crit_traits; - using boost::container::container_detail::is_same; + using boost::intrusive::detail::is_same; //iterator_category BOOST_STATIC_ASSERT((is_same::value)); BOOST_STATIC_ASSERT((is_same::value)); @@ -340,7 +340,7 @@ void test_iterator_bidirectional(C &c) typedef iterator_traits rnit_traits; typedef iterator_traits crit_traits; - using boost::container::container_detail::is_same; + using boost::intrusive::detail::is_same; //iterator_category BOOST_STATIC_ASSERT((is_same::value)); BOOST_STATIC_ASSERT((is_same::value)); @@ -362,7 +362,7 @@ void test_iterator_random(C &c) typedef iterator_traits rnit_traits; typedef iterator_traits crit_traits; - using boost::container::container_detail::is_same; + using boost::intrusive::detail::is_same; //iterator_category BOOST_STATIC_ASSERT((is_same::value)); BOOST_STATIC_ASSERT((is_same::value)); From b795de217ba947d84098f68f899c2f5e53f5ff5a Mon Sep 17 00:00:00 2001 From: Jeff Snyder Date: Wed, 8 May 2019 16:22:23 +0100 Subject: [PATCH 9/9] Allow void as an option with BOOST_INTRUSIVE_VARIADIC_TEMPLATES enabled --- include/boost/intrusive/pack_options.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/boost/intrusive/pack_options.hpp b/include/boost/intrusive/pack_options.hpp index 944243f..ff07678 100644 --- a/include/boost/intrusive/pack_options.hpp +++ b/include/boost/intrusive/pack_options.hpp @@ -209,6 +209,12 @@ struct do_pack > typedef typename Prev::template pack type; }; +template +struct do_pack > +{ + typedef typename do_pack >::type type; +}; + template struct do_pack > {