From e16f2de233123517dd5031781a6c4b03c3c65dbe Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Wed, 27 Dec 2017 09:20:39 +0100 Subject: [PATCH 001/173] Inheriting std::iterator is deprecated in c++17. Boost's iterator.hpp is deprecated, too. Therefore get rid of all of that and replace inheritance by lifting std::iterator's members into the derived class. Signed-off-by: Daniela Engert --- .../boost/iterator/iterator_archetypes.hpp | 17 +++---- test/concept_tests.cpp | 14 +++++- test/is_lvalue_iterator.cpp | 31 +++++++----- test/is_readable_iterator.cpp | 48 +++++++++++-------- 4 files changed, 67 insertions(+), 43 deletions(-) diff --git a/include/boost/iterator/iterator_archetypes.hpp b/include/boost/iterator/iterator_archetypes.hpp index 9b4b543f4..1d2591528 100644 --- a/include/boost/iterator/iterator_archetypes.hpp +++ b/include/boost/iterator/iterator_archetypes.hpp @@ -426,15 +426,16 @@ namespace detail >::type iterator_category; // Needed for some broken libraries (see below) - typedef boost::iterator< - iterator_category - , Value - , typename traversal_archetype_base< + struct workaround_iterator_base + { + typedef typename iterator_archetype_base::iterator_category iterator_category; + typedef Value value_type; + typedef typename traversal_archetype_base< Value, AccessCategory, TraversalCategory - >::difference_type - , typename access::pointer - , typename access::reference - > workaround_iterator_base; + >::difference_type difference_type; + typedef typename access::pointer pointer; + typedef typename access::reference reference; + }; }; } diff --git a/test/concept_tests.cpp b/test/concept_tests.cpp index f89cd54a3..5fb6a78b4 100644 --- a/test/concept_tests.cpp +++ b/test/concept_tests.cpp @@ -16,8 +16,13 @@ struct new_random_access {}; struct new_iterator - : public std::iterator< new_random_access, int > { + typedef new_random_access iterator_category; + typedef int value_type; + typedef std::ptrdiff_t difference_type; + typedef int* pointer; + typedef int& reference; + int& operator*() const { return *m_x; } new_iterator& operator++() { return *this; } new_iterator operator++(int) { return *this; } @@ -36,8 +41,13 @@ struct new_iterator new_iterator operator+(std::ptrdiff_t, new_iterator x) { return x; } struct old_iterator - : public std::iterator { + typedef std::random_access_iterator_tag iterator_category; + typedef int value_type; + typedef std::ptrdiff_t difference_type; + typedef int* pointer; + typedef int& reference; + int& operator*() const { return *m_x; } old_iterator& operator++() { return *this; } old_iterator operator++(int) { return *this; } diff --git a/test/is_lvalue_iterator.cpp b/test/is_lvalue_iterator.cpp index a3f7b6fa4..38710323e 100644 --- a/test/is_lvalue_iterator.cpp +++ b/test/is_lvalue_iterator.cpp @@ -5,10 +5,10 @@ #include #include #include +#include // std::ptrdiff_t #include #include #include -#include // Last, for BOOST_NO_LVALUE_RETURN_DETECTION #include @@ -20,29 +20,36 @@ struct v }; -struct value_iterator : boost::iterator +struct value_iterator { + typedef std::input_iterator_tag iterator_category; + typedef v value_type; + typedef std::ptrdiff_t difference_type; + typedef v* pointer; + typedef v& reference; + v operator*() const; }; -struct noncopyable_iterator : boost::iterator +struct noncopyable_iterator { + typedef std::forward_iterator_tag iterator_category; + typedef boost::noncopyable value_type; + typedef std::ptrdiff_t difference_type; + typedef boost::noncopyable* pointer; + typedef boost::noncopyable& reference; + boost::noncopyable const& operator*() const; }; template struct proxy_iterator - : boost::iterator { typedef T value_type; - -#if BOOST_WORKAROUND(__GNUC__, == 2) - typedef boost::iterator base; - typedef base::iterator_category iterator_category; - typedef base::difference_type difference_type; - typedef base::pointer pointer; - typedef base::reference reference; -#endif + typedef std::output_iterator_tag iterator_category; + typedef std::ptrdiff_t difference_type; + typedef T* pointer; + typedef T& reference; struct proxy { diff --git a/test/is_readable_iterator.cpp b/test/is_readable_iterator.cpp index ee58089d3..c6636977e 100644 --- a/test/is_readable_iterator.cpp +++ b/test/is_readable_iterator.cpp @@ -5,10 +5,10 @@ #include #include #include +#include // std::ptrdiff_t #include #include #include -#include // Last, for BOOST_NO_LVALUE_RETURN_DETECTION #include @@ -20,26 +20,35 @@ struct v }; -struct value_iterator : boost::iterator +struct value_iterator { + typedef std::input_iterator_tag iterator_category; + typedef v value_type; + typedef std::ptrdiff_t difference_type; + typedef v* pointer; + typedef v& reference; + v operator*() const; }; -struct noncopyable_iterator : boost::iterator +struct noncopyable_iterator { + typedef std::forward_iterator_tag iterator_category; + typedef boost::noncopyable value_type; + typedef std::ptrdiff_t difference_type; + typedef boost::noncopyable* pointer; + typedef boost::noncopyable& reference; + boost::noncopyable const& operator*() const; }; -struct proxy_iterator : boost::iterator +struct proxy_iterator { -#if BOOST_WORKAROUND(__GNUC__, == 2) - typedef boost::iterator base; - typedef base::iterator_category iterator_category; - typedef base::value_type value_type; - typedef base::difference_type difference_type; - typedef base::pointer pointer; - typedef base::reference reference; -#endif + typedef std::output_iterator_tag iterator_category; + typedef v value_type; + typedef std::ptrdiff_t difference_type; + typedef v* pointer; + typedef v& reference; struct proxy { @@ -50,16 +59,13 @@ struct proxy_iterator : boost::iterator proxy operator*() const; }; -struct proxy_iterator2 : boost::iterator +struct proxy_iterator2 { -#if BOOST_WORKAROUND(__GNUC__, == 2) - typedef boost::iterator base; - typedef base::iterator_category iterator_category; - typedef base::value_type value_type; - typedef base::difference_type difference_type; - typedef base::pointer pointer; - typedef base::reference reference; -#endif + typedef std::output_iterator_tag iterator_category; + typedef v value_type; + typedef std::ptrdiff_t difference_type; + typedef v* pointer; + typedef v& reference; struct proxy { From 44cee008314313dc33d4c6ceeced41efdd3bf936 Mon Sep 17 00:00:00 2001 From: morinmorin Date: Sat, 22 Sep 2018 20:19:32 +0900 Subject: [PATCH 002/173] Replace using-declarations with using-directives to avoid ADL issues. --- include/boost/iterator/advance.hpp | 2 +- include/boost/iterator/distance.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/iterator/advance.hpp b/include/boost/iterator/advance.hpp index 6f81cdb6b..92af8fbfe 100644 --- a/include/boost/iterator/advance.hpp +++ b/include/boost/iterator/advance.hpp @@ -77,7 +77,7 @@ namespace iterators { } // namespace iterators -using iterators::advance; +using namespace iterators::advance_adl_barrier; } // namespace boost diff --git a/include/boost/iterator/distance.hpp b/include/boost/iterator/distance.hpp index 8cf3f15c4..bef650b28 100644 --- a/include/boost/iterator/distance.hpp +++ b/include/boost/iterator/distance.hpp @@ -58,7 +58,7 @@ namespace iterators { } // namespace iterators -using iterators::distance; +using namespace iterators::distance_adl_barrier; } // namespace boost From b5edc8b64f0e2f65f3bf63968acc794c8ce93de1 Mon Sep 17 00:00:00 2001 From: morinmorin Date: Sat, 22 Sep 2018 20:44:29 +0900 Subject: [PATCH 003/173] Add test for ADL issues. --- test/Jamfile.v2 | 3 +++ test/adl_test.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 test/adl_test.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index ac694e1eb..2a0eea0cd 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -59,4 +59,7 @@ test-suite iterator [ run next_prior_test.cpp ] [ run advance_test.cpp ] [ run distance_test.cpp ] + [ compile adl_test.cpp ] + + [ run shared_iterator_test.cpp ] ; diff --git a/test/adl_test.cpp b/test/adl_test.cpp new file mode 100644 index 000000000..5d5f69968 --- /dev/null +++ b/test/adl_test.cpp @@ -0,0 +1,25 @@ +// Copyright (C) 2017 Michel Morin. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include + +int main() +{ + // Test that boost::advance/distance are not found by ADL. + // (https://github.com/boostorg/iterator/issues/43) + + typedef boost::array boost_type; + std::vector std_boost(2); + std::vector::iterator it = std_boost.begin(); + + advance(it, 2); + (void)distance(it, it); + + return 0; +} From 06875a754d6a1e7ed14b761d26020239cf5ad0a2 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 22 Sep 2018 18:46:36 +0300 Subject: [PATCH 004/173] Revert "Replace using-declarations with using-directives to avoid ADL issues." This reverts commit 44cee008314313dc33d4c6ceeced41efdd3bf936. The commit reportedly broke building Boost and quickbook. https://github.com/boostorg/iterator/commit/b844c8df530c474ec1856870b9b0de5f487b84d4#commitcomment-30603668 --- include/boost/iterator/advance.hpp | 2 +- include/boost/iterator/distance.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/iterator/advance.hpp b/include/boost/iterator/advance.hpp index 92af8fbfe..6f81cdb6b 100644 --- a/include/boost/iterator/advance.hpp +++ b/include/boost/iterator/advance.hpp @@ -77,7 +77,7 @@ namespace iterators { } // namespace iterators -using namespace iterators::advance_adl_barrier; +using iterators::advance; } // namespace boost diff --git a/include/boost/iterator/distance.hpp b/include/boost/iterator/distance.hpp index bef650b28..8cf3f15c4 100644 --- a/include/boost/iterator/distance.hpp +++ b/include/boost/iterator/distance.hpp @@ -58,7 +58,7 @@ namespace iterators { } // namespace iterators -using namespace iterators::distance_adl_barrier; +using iterators::distance; } // namespace boost From 6ab148be0195f856d243be825125a19bbb2aa4fc Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 23 Sep 2018 12:28:03 +0300 Subject: [PATCH 005/173] Revert "Revert "Replace using-declarations with using-directives to avoid ADL issues."" This reverts commit 06875a754d6a1e7ed14b761d26020239cf5ad0a2. The suggested fix for build failures need to be applied to Boost.Range: https://github.com/boostorg/range/pull/75 --- include/boost/iterator/advance.hpp | 2 +- include/boost/iterator/distance.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/iterator/advance.hpp b/include/boost/iterator/advance.hpp index 6f81cdb6b..92af8fbfe 100644 --- a/include/boost/iterator/advance.hpp +++ b/include/boost/iterator/advance.hpp @@ -77,7 +77,7 @@ namespace iterators { } // namespace iterators -using iterators::advance; +using namespace iterators::advance_adl_barrier; } // namespace boost diff --git a/include/boost/iterator/distance.hpp b/include/boost/iterator/distance.hpp index 8cf3f15c4..bef650b28 100644 --- a/include/boost/iterator/distance.hpp +++ b/include/boost/iterator/distance.hpp @@ -58,7 +58,7 @@ namespace iterators { } // namespace iterators -using iterators::distance; +using namespace iterators::distance_adl_barrier; } // namespace boost From 3cc4107d01b152bc2417d434b6fa22925a34aecd Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 23 Sep 2018 12:37:21 +0300 Subject: [PATCH 006/173] Added a test for compatibility of boost::distance between Range and Iterator. This functionality is used in core Boost components, so it is preferable to test it in Boost.Iterator, even if it's already tested in Boost.Range, to discover problems as early as possible. The test verifies that boost::distance implemented in Boost.Range can invoke boost::distance in Boost.Iterator (i.e. the function lookup succeeds). --- test/Jamfile.v2 | 1 + test/range_distance_compat_test.cpp | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 test/range_distance_compat_test.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 2a0eea0cd..14b7b2a0c 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -60,6 +60,7 @@ test-suite iterator [ run advance_test.cpp ] [ run distance_test.cpp ] [ compile adl_test.cpp ] + [ compile range_distance_compat_test.cpp ] [ run shared_iterator_test.cpp ] ; diff --git a/test/range_distance_compat_test.cpp b/test/range_distance_compat_test.cpp new file mode 100644 index 000000000..ef7e301da --- /dev/null +++ b/test/range_distance_compat_test.cpp @@ -0,0 +1,22 @@ +// Copyright (C) 2018 Andrey Semashev +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +int main() +{ + // Test that boost::distance from Boost.Range works with boost::distance from Boost.Iterator + // (https://github.com/boostorg/iterator/commit/b844c8df530c474ec1856870b9b0de5f487b84d4#commitcomment-30603668) + + typedef boost::iterator_range range_type; + range_type range; + + (void)boost::distance(range); + + return 0; +} From bb1efd337025901e4b8e036167206e3482f5c92e Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 14 Nov 2018 12:42:24 +0300 Subject: [PATCH 007/173] Updated addressof.hpp include path. --- include/boost/iterator/iterator_facade.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 225c53a23..b43e618f0 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include From 73918b86161e3bbd19879ba8f5316704fc2794c9 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 18 Dec 2018 19:49:23 +0300 Subject: [PATCH 008/173] Added an experimental partial CMakeLists.txt for dependency tracking in CMake projects. --- CMakeLists.txt | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..aab275154 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,34 @@ +# Copyright 2018 Peter Dimov +# Copyright 2018 Andrey Semashev +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt + +# Partial (add_subdirectory only) and experimental CMake support +# Subject to change; please do not rely on the contents of this file yet. + +cmake_minimum_required(VERSION 3.5) + +project(BoostIterator LANGUAGES CXX) + +add_library(boost_iterator INTERFACE) +add_library(Boost::iterator ALIAS boost_iterator) + +target_include_directories(boost_iterator INTERFACE include) + +target_link_libraries(boost_iterator + INTERFACE + Boost::assert + Boost::concept_check + Boost::config + Boost::conversion + Boost::core + Boost::detail + Boost::function_types + Boost::fusion + Boost::mpl + Boost::optional + Boost::smart_ptr + Boost::static_assert + Boost::type_traits + Boost::utility +) From 20b5a9c11a99649935b8fc056ca61d0a929b395d Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 18 Dec 2018 22:05:56 +0300 Subject: [PATCH 009/173] Added tools/boost_install and libs/headers manual checkout to CI jobs. --- .travis.yml | 8 +++++--- appveyor.yml | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index c0e97f131..8dfa76bbe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -71,9 +71,11 @@ install: - cd .. - git clone -b $BOOST_BRANCH --depth 1 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 + - git submodule init tools/build + - git submodule init tools/boostdep + - git submodule init tools/boost_install + - git submodule init libs/headers + - git submodule update - cp -r $TRAVIS_BUILD_DIR/* libs/iterator - python tools/boostdep/depinst/depinst.py iterator - ./bootstrap.sh diff --git a/appveyor.yml b/appveyor.yml index b236d12de..43e906c87 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,9 +28,11 @@ install: - cd .. - git clone -b %BOOST_BRANCH% --depth 1 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 + - git submodule init tools/build + - git submodule init tools/boostdep + - git submodule init tools/boost_install + - git submodule init libs/headers + - git submodule update - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\iterator - python tools/boostdep/depinst/depinst.py iterator - cmd /c bootstrap From 02e74bf26a9cccc914cff7aa5c53fce2412fc310 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 18 Dec 2018 22:34:58 +0300 Subject: [PATCH 010/173] Use multiple jobs to checkout submodules in parallel in CI. --- .travis.yml | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8dfa76bbe..f1ae484b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,7 +75,7 @@ install: - git submodule init tools/boostdep - git submodule init tools/boost_install - git submodule init libs/headers - - git submodule update + - git submodule update --jobs 4 - cp -r $TRAVIS_BUILD_DIR/* libs/iterator - python tools/boostdep/depinst/depinst.py iterator - ./bootstrap.sh diff --git a/appveyor.yml b/appveyor.yml index 43e906c87..498099cac 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,7 +32,7 @@ install: - git submodule init tools/boostdep - git submodule init tools/boost_install - git submodule init libs/headers - - git submodule update + - git submodule update --jobs 4 - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\iterator - python tools/boostdep/depinst/depinst.py iterator - cmd /c bootstrap From e31ae13df5e5a49c5e21ffa61b0da72487f3ff6a Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 20 Dec 2018 20:46:10 +0300 Subject: [PATCH 011/173] Re-added manual checkout of libs/config in CI as Boost.Build depends on it. --- .travis.yml | 1 + appveyor.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index f1ae484b2..160465925 100644 --- a/.travis.yml +++ b/.travis.yml @@ -75,6 +75,7 @@ install: - git submodule init tools/boostdep - git submodule init tools/boost_install - git submodule init libs/headers + - git submodule init libs/config - git submodule update --jobs 4 - cp -r $TRAVIS_BUILD_DIR/* libs/iterator - python tools/boostdep/depinst/depinst.py iterator diff --git a/appveyor.yml b/appveyor.yml index 498099cac..9c6eb3fa2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,6 +32,7 @@ install: - git submodule init tools/boostdep - git submodule init tools/boost_install - git submodule init libs/headers + - git submodule init libs/config - git submodule update --jobs 4 - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\iterator - python tools/boostdep/depinst/depinst.py iterator From 398fe907d0a0be570e254ca177f33cd9850d4e97 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 3 Jan 2019 23:19:41 +0300 Subject: [PATCH 012/173] Use the actual number of logical CPUs for the number of CI build/test jobs. --- .travis.yml | 6 ++++-- appveyor.yml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 160465925..adc5aa434 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,7 +67,8 @@ matrix: env: TOOLSET=clang CXXSTD=03,11,14,1z install: - - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true + - BOOST_BRANCH=develop + - if [ "$TRAVIS_BRANCH" = "master" ]; then BOOST_BRANCH=master; fi - cd .. - git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root - cd boost-root @@ -83,7 +84,8 @@ install: - ./b2 headers script: - - ./b2 -j3 libs/iterator/test toolset=$TOOLSET cxxstd=$CXXSTD + - BUILD_JOBS=`(nproc || sysctl -n hw.ncpu) 2> /dev/null` + - ./b2 -j $BUILD_JOBS libs/iterator/test toolset=$TOOLSET cxxstd=$CXXSTD notifications: email: diff --git a/appveyor.yml b/appveyor.yml index 9c6eb3fa2..a0c8cae32 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -43,4 +43,4 @@ build: off test_script: - if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD% - - b2 -j3 libs/iterator/test toolset=%TOOLSET% %CXXSTD% + - b2 -j %NUMBER_OF_PROCESSORS% libs/iterator/test toolset=%TOOLSET% %CXXSTD% From 171c716d0316200f3503aededb56a2f16d469333 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 15 Jan 2019 13:54:52 +0300 Subject: [PATCH 013/173] Enabled multiple git fetch jobs while executing depinst in CI. Increased the number of jobs to 8. --- .travis.yml | 5 +++-- appveyor.yml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index adc5aa434..d24ddab99 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,6 +67,7 @@ matrix: env: TOOLSET=clang CXXSTD=03,11,14,1z install: + - GIT_FETCH_JOBS=8 - BOOST_BRANCH=develop - if [ "$TRAVIS_BRANCH" = "master" ]; then BOOST_BRANCH=master; fi - cd .. @@ -77,9 +78,9 @@ install: - git submodule init tools/boost_install - git submodule init libs/headers - git submodule init libs/config - - git submodule update --jobs 4 + - git submodule update --jobs $GIT_FETCH_JOBS - cp -r $TRAVIS_BUILD_DIR/* libs/iterator - - python tools/boostdep/depinst/depinst.py iterator + - python tools/boostdep/depinst/depinst.py --git_args "--jobs $GIT_FETCH_JOBS" iterator - ./bootstrap.sh - ./b2 headers diff --git a/appveyor.yml b/appveyor.yml index a0c8cae32..447a66753 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,6 +23,7 @@ environment: CXXSTD: 14,17 install: + - set GIT_FETCH_JOBS=8 - set BOOST_BRANCH=develop - if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master - cd .. @@ -33,9 +34,9 @@ install: - git submodule init tools/boost_install - git submodule init libs/headers - git submodule init libs/config - - git submodule update --jobs 4 + - git submodule update --jobs %GIT_FETCH_JOBS% - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\iterator - - python tools/boostdep/depinst/depinst.py iterator + - python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" iterator - cmd /c bootstrap - b2 -d0 headers From 2af5a165390809f09ecfaecadbe23df90394c789 Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Fri, 22 Feb 2019 17:17:52 -0500 Subject: [PATCH 014/173] Use use_default from Boost.Core boost::use_default is now defined in Core for multiple Boost libraries. --- include/boost/iterator/detail/facade_iterator_category.hpp | 5 +++-- include/boost/iterator/iterator_adaptor.hpp | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/boost/iterator/detail/facade_iterator_category.hpp b/include/boost/iterator/detail/facade_iterator_category.hpp index 67fdf446b..6db45e453 100644 --- a/include/boost/iterator/detail/facade_iterator_category.hpp +++ b/include/boost/iterator/detail/facade_iterator_category.hpp @@ -4,6 +4,8 @@ #ifndef FACADE_ITERATOR_CATEGORY_DWA20031118_HPP # define FACADE_ITERATOR_CATEGORY_DWA20031118_HPP +# include + # include # include // used in iterator_tag inheritance logic @@ -33,8 +35,7 @@ namespace boost { namespace iterators { -// forward declaration -struct use_default; +using boost::use_default; namespace detail { diff --git a/include/boost/iterator/iterator_adaptor.hpp b/include/boost/iterator/iterator_adaptor.hpp index f803fc65e..db1c4daa3 100644 --- a/include/boost/iterator/iterator_adaptor.hpp +++ b/include/boost/iterator/iterator_adaptor.hpp @@ -9,6 +9,8 @@ #include +#include + #include #include #include @@ -35,12 +37,10 @@ namespace iterators { // Used as a default template argument internally, merely to // indicate "use the default", this can also be passed by users // explicitly in order to specify that the default should be used. - struct use_default; + using boost::use_default; } // namespace iterators -using iterators::use_default; - // the incompleteness of use_default causes massive problems for // is_convertible (naturally). This workaround is fortunately not // needed for vc6/vc7. From 54dee0db96074faa9576c9891960f50449b37e76 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 22 Oct 2019 01:00:51 +0300 Subject: [PATCH 015/173] Updated CI configs, added compilers. --- .travis.yml | 321 ++++++++++++++++++++++++++++++++++++++++++++++++--- appveyor.yml | 47 ++++++-- 2 files changed, 348 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index d24ddab99..317b6572c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ # Copyright 2016, 2017 Peter Dimov +# Copyright 2019 Andrey Semashev # 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) @@ -24,13 +25,66 @@ matrix: - env: BOGUS_JOB=true include: +# gcc, Linux - os: linux - compiler: g++ - env: TOOLSET=gcc CXXSTD=03,11 + dist: trusty + compiler: gcc-4.4 + env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x + addons: + apt: + packages: + - g++-4.4 + sources: + - ubuntu-toolchain-r-test + + - os: linux + dist: trusty + compiler: gcc-4.6 + env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x + addons: + apt: + packages: + - g++-4.6 + sources: + - ubuntu-toolchain-r-test + + - os: linux + dist: trusty + compiler: gcc-4.7 + env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11 + addons: + apt: + packages: + - g++-4.7 + sources: + - ubuntu-toolchain-r-test - os: linux - compiler: g++-5 - env: TOOLSET=gcc-5 CXXSTD=03,11,14,1z + dist: xenial + compiler: gcc-4.8 + env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11 + addons: + apt: + packages: + - g++-4.8 + sources: + - ubuntu-toolchain-r-test + + - os: linux + dist: xenial + compiler: gcc-4.9 + env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11 + addons: + apt: + packages: + - g++-4.9 + sources: + - ubuntu-toolchain-r-test + + - os: linux + dist: xenial + compiler: gcc-5 + env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z addons: apt: packages: @@ -39,8 +93,9 @@ matrix: - ubuntu-toolchain-r-test - os: linux - compiler: g++-6 - env: TOOLSET=gcc-6 CXXSTD=03,11,14,1z + dist: xenial + compiler: gcc-6 + env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z addons: apt: packages: @@ -49,8 +104,9 @@ matrix: - ubuntu-toolchain-r-test - os: linux - compiler: g++-7 - env: TOOLSET=gcc-7 CXXSTD=03,11,14,17 + dist: xenial + compiler: gcc-7 + env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17 addons: apt: packages: @@ -59,12 +115,249 @@ matrix: - ubuntu-toolchain-r-test - os: linux - compiler: clang++ - env: TOOLSET=clang CXXSTD=03,11,14,1z + dist: xenial + compiler: gcc-8 + env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17,2a + addons: + apt: + packages: + - g++-8 + sources: + - ubuntu-toolchain-r-test + + - os: linux + dist: bionic + compiler: gcc-9 + env: TOOLSET=gcc COMPILER=g++-9 CXXSTD=03,11,14,17,2a + addons: + apt: + packages: + - g++-9 + sources: + - sourceline: "ppa:ubuntu-toolchain-r/test" + + - os: linux + dist: bionic + compiler: gcc-UBSAN + env: UBSAN=1 TOOLSET=gcc COMPILER=g++-9 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold + addons: + apt: + packages: + - g++-9 + sources: + - sourceline: "ppa:ubuntu-toolchain-r/test" + +# clang, Linux + - os: linux + dist: trusty + compiler: clang-3.5 + env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11 + addons: + apt: + packages: + - clang-3.5 + - libstdc++-4.9-dev + sources: + - ubuntu-toolchain-r-test + - sourceline: "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.5 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: trusty + compiler: clang-3.6 + env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11 + addons: + apt: + packages: + - clang-3.6 + - libstdc++-5-dev + sources: + - ubuntu-toolchain-r-test + - sourceline: "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.6 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: trusty + compiler: clang-3.7 + env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11 + addons: + apt: + packages: + - clang-3.7 + - libstdc++-5-dev + sources: + - ubuntu-toolchain-r-test + - sourceline: "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.7 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: xenial + compiler: clang-3.8 + env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z + addons: + apt: + packages: + - clang-3.8 + - libstdc++-6-dev + sources: + - ubuntu-toolchain-r-test + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.8 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: xenial + compiler: clang-3.9 + env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z + addons: + apt: + packages: + - clang-3.9 + - libstdc++-6-dev + sources: + - ubuntu-toolchain-r-test + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: xenial + compiler: clang-4 + env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z + addons: + apt: + packages: + - clang-4.0 + - libstdc++-6-dev + sources: + - ubuntu-toolchain-r-test + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: xenial + compiler: clang-5 + env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z + addons: + apt: + packages: + - clang-5.0 + - libstdc++-7-dev + sources: + - ubuntu-toolchain-r-test + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: xenial + compiler: clang-6 + env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17,2a + addons: + apt: + packages: + - clang-6.0 + - libstdc++-8-dev + sources: + - ubuntu-toolchain-r-test + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: xenial + compiler: clang-7 + env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17,2a + addons: + apt: + packages: + - clang-7 + - libstdc++-8-dev + sources: + - ubuntu-toolchain-r-test + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: xenial + compiler: clang-8 + env: TOOLSET=clang COMPILER=clang++-8 CXXSTD=03,11,14,17,2a + addons: + apt: + packages: + - clang-8 + - libstdc++-8-dev + sources: + - ubuntu-toolchain-r-test + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: xenial + compiler: clang-9 + env: TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a + addons: + apt: + packages: + - clang-9 + - libstdc++-9-dev + sources: + - sourceline: "ppa:ubuntu-toolchain-r/test" + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: xenial + compiler: clang-UBSAN + env: UBSAN=1 TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1 + addons: + apt: + packages: + - clang-9 + - libstdc++-9-dev + sources: + - sourceline: "ppa:ubuntu-toolchain-r/test" + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: xenial + compiler: clang-libc++ + env: TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a CXXFLAGS="-stdlib=libc++" LINKFLAGS="-stdlib=libc++" + addons: + apt: + packages: + - clang-9 + - libc++-9-dev + - libc++abi-9-dev + sources: + - sourceline: "ppa:ubuntu-toolchain-r/test" + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + + - os: linux + dist: xenial + compiler: clang-libc++-UBSAN + env: UBSAN=1 TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1 CXXFLAGS="-stdlib=libc++" LINKFLAGS="-stdlib=libc++" + addons: + apt: + packages: + - clang-9 + - libc++-9-dev + - libc++abi-9-dev + sources: + - sourceline: "ppa:ubuntu-toolchain-r/test" + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + +# clang, OS X + - os: osx + env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z + osx_image: xcode9.4 + + - os: osx + env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z + osx_image: xcode10.3 - os: osx - compiler: clang++ - env: TOOLSET=clang CXXSTD=03,11,14,1z + env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,17 + osx_image: xcode11.2 install: - GIT_FETCH_JOBS=8 @@ -85,8 +378,10 @@ install: - ./b2 headers script: + - |- + echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam - BUILD_JOBS=`(nproc || sysctl -n hw.ncpu) 2> /dev/null` - - ./b2 -j $BUILD_JOBS libs/iterator/test toolset=$TOOLSET cxxstd=$CXXSTD + - ./b2 -j $BUILD_JOBS libs/iterator/test toolset=$TOOLSET cxxstd=$CXXSTD ${UBSAN:+cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined linkflags=-fsanitize=undefined define=UBSAN=1 debug-symbols=on visibility=global} ${CXXFLAGS:+cxxflags="$CXXFLAGS"} ${LINKFLAGS:+linkflags="$LINKFLAGS"} notifications: email: diff --git a/appveyor.yml b/appveyor.yml index 447a66753..2249a0adc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,5 @@ # Copyright 2017 Edward Diener +# Copyright 2019 Andrey Semashev # 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) @@ -14,13 +15,43 @@ branches: environment: matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 - TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: msvc-14.0 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - TOOLSET: msvc-14.1 + - TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + - TOOLSET: msvc-14.0 + ADDRMD: 32,64 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + - TOOLSET: msvc-14.1 CXXSTD: 14,17 + ADDRMD: 32,64 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + - TOOLSET: msvc-14.2 + ADDRMD: 32,64 + CXXSTD: 14,17 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + - TOOLSET: clang-win + ADDRMD: 32,64 + CXXSTD: 14,17 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + - TOOLSET: gcc + CXXSTD: 03,11,14,1z + ADDPATH: C:\cygwin\bin; + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + - TOOLSET: gcc + CXXSTD: 03,11,14,1z + ADDPATH: C:\cygwin64\bin; + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + - TOOLSET: gcc + CXXSTD: 03,11,14,1z + ADDPATH: C:\mingw\bin; + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + - TOOLSET: gcc + CXXSTD: 03,11,14,1z + ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin; + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + - TOOLSET: gcc + CXXSTD: 03,11,14,1z + ADDPATH: C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin; + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 install: - set GIT_FETCH_JOBS=8 @@ -43,5 +74,7 @@ install: build: off test_script: + - PATH=%ADDPATH%%PATH% - if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD% - - b2 -j %NUMBER_OF_PROCESSORS% libs/iterator/test toolset=%TOOLSET% %CXXSTD% + - if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD% + - b2 -j %NUMBER_OF_PROCESSORS% libs/iterator/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% From 540f999d0b671c14082b93979b7885b6973ce18b Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 22 Oct 2019 15:07:04 +0300 Subject: [PATCH 016/173] Disabled all but one OS X jobs because they are slow on Travis CI. --- .travis.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 317b6572c..92aed2380 100644 --- a/.travis.yml +++ b/.travis.yml @@ -347,13 +347,14 @@ matrix: key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" # clang, OS X - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z - osx_image: xcode9.4 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z - osx_image: xcode10.3 +# OS X builds are slow on Travis CI +# - os: osx +# env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z +# osx_image: xcode9.4 +# +# - os: osx +# env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z +# osx_image: xcode10.3 - os: osx env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,17 From d528fc0b11c91eec8851878e1aaac159d1131020 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 23 Oct 2019 12:09:29 +0300 Subject: [PATCH 017/173] Disabled C++0x mode for gcc-4.4 because it fails zip_iterator tests with std::tuple. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 92aed2380..b3289de75 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,10 +26,11 @@ matrix: include: # gcc, Linux +# Note: gcc-4.4 in C++0x mode fails zip_iterator tests with std::tuple - os: linux dist: trusty compiler: gcc-4.4 - env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x + env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98 addons: apt: packages: From bfe2a004d260a8f607adb33c3be9439d003c8392 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Sat, 23 Nov 2019 16:47:06 +0300 Subject: [PATCH 018/173] Add deprecation warning in `boost/function_output_iterator.hpp` --- include/boost/function_output_iterator.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/boost/function_output_iterator.hpp b/include/boost/function_output_iterator.hpp index 15dbcb9f5..1584d9c84 100644 --- a/include/boost/function_output_iterator.hpp +++ b/include/boost/function_output_iterator.hpp @@ -9,6 +9,10 @@ // This is a deprecated header left for backward compatibility. // Use boost/iterator/function_output_iterator.hpp instead. +#include + +BOOST_HEADER_DEPRECATED("") + #include #endif // BOOST_FUNCTION_OUTPUT_ITERATOR_HPP From 897ff65fdc03c14394801589d6a2b40c8d81dc24 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 12 Dec 2019 12:16:01 +0300 Subject: [PATCH 019/173] Fixed example links in docs. Fixes https://github.com/boostorg/iterator/issues/52. --- doc/quickbook/adaptor.qbk | 2 +- doc/quickbook/counting_iterator.qbk | 2 +- doc/quickbook/facade_tutorial.qbk | 8 +++--- doc/quickbook/filter_iterator.qbk | 2 +- doc/quickbook/indirect_iterator.qbk | 5 ++-- doc/quickbook/iterator.qbk | 2 +- doc/quickbook/permutation_iterator.qbk | 30 ++++++++++----------- doc/quickbook/reverse_iterator.qbk | 2 +- doc/quickbook/shared_container_iterator.qbk | 6 ++--- doc/quickbook/transform_iterator.qbk | 2 +- 10 files changed, 30 insertions(+), 31 deletions(-) diff --git a/doc/quickbook/adaptor.qbk b/doc/quickbook/adaptor.qbk index d791ce00f..0cf435e3f 100644 --- a/doc/quickbook/adaptor.qbk +++ b/doc/quickbook/adaptor.qbk @@ -288,7 +288,7 @@ Metrowerks CodeWarrior versions prior to 9.0] You can see an example program that exercises this version of the node iterators -[@../example/node_iterator3.cpp `here`]. +[example_link node_iterator3.cpp..here]. In the case of `node_iter`, it's not very compelling to pass diff --git a/doc/quickbook/counting_iterator.qbk b/doc/quickbook/counting_iterator.qbk index c33d06562..f661c407f 100644 --- a/doc/quickbook/counting_iterator.qbk +++ b/doc/quickbook/counting_iterator.qbk @@ -39,7 +39,7 @@ The output is: indirectly printing out the numbers from 0 to 7 0 1 2 3 4 5 6 -The source code for this example can be found [@../example/counting_iterator_example.cpp here]. +The source code for this example can be found [example_link counting_iterator_example.cpp..here]. [h2 Reference] diff --git a/doc/quickbook/facade_tutorial.qbk b/doc/quickbook/facade_tutorial.qbk index ad066c8e5..cb6428273 100644 --- a/doc/quickbook/facade_tutorial.qbk +++ b/doc/quickbook/facade_tutorial.qbk @@ -255,9 +255,9 @@ make them private and grant friendship to Voila; a complete and conforming readable, forward-traversal iterator! For a working example of its use, see -[@../example/node_iterator1.cpp `this program`]. +[example_link node_iterator1.cpp..this program]. -__ ../example/node_iterator1.cpp +__ ../../example/node_iterator1.cpp [h2 A constant `node_iterator`] @@ -428,11 +428,11 @@ adding a templatized converting constructor [#broken]_ [#random]_: `distance_to` function as well. -__ ../example/node_iterator2.hpp +__ ../../example/node_iterator2.hpp You can see an example program which exercises our interoperable iterators -[@../example/node_iterator2.cpp `here`]. +[example_link node_iterator2.cpp..here]. [h2 Telling the Truth] diff --git a/doc/quickbook/filter_iterator.qbk b/doc/quickbook/filter_iterator.qbk index 5076353b3..c536d5b4a 100644 --- a/doc/quickbook/filter_iterator.qbk +++ b/doc/quickbook/filter_iterator.qbk @@ -75,7 +75,7 @@ The output is: 0 -1 4 5 8 -The source code for this example can be found [@../example/filter_iterator_example.cpp here]. +The source code for this example can be found [example_link filter_iterator_example.cpp..here]. [h2 Reference] diff --git a/doc/quickbook/indirect_iterator.qbk b/doc/quickbook/indirect_iterator.qbk index 2556aa25f..22589be39 100644 --- a/doc/quickbook/indirect_iterator.qbk +++ b/doc/quickbook/indirect_iterator.qbk @@ -1,4 +1,3 @@ - [section:indirect Indirect Iterator] `indirect_iterator` adapts an iterator by applying an @@ -73,7 +72,7 @@ The output is: The source code for this example can be found -[@../example/indirect_iterator_example.cpp here]. +[example_link indirect_iterator_example.cpp..here]. [h2 Reference] @@ -251,4 +250,4 @@ following operations: [*Effects: ] `--m_iterator`[br] [*Returns: ] `*this` -[endsect] \ No newline at end of file +[endsect] diff --git a/doc/quickbook/iterator.qbk b/doc/quickbook/iterator.qbk index 6a20e33c6..8fff64c77 100644 --- a/doc/quickbook/iterator.qbk +++ b/doc/quickbook/iterator.qbk @@ -1,4 +1,3 @@ - [library Boost.Iterator [/ version 1.0.1] [quickbook 1.6] @@ -31,6 +30,7 @@ [def _iterator_ [@../../../iterator/doc/index.html Boost.Iterator]] [def _concept_check_ [@../../../concept_check/index.html Boost.ConceptCheck]] +[template example_link[name descr]''''''[descr]''''''] [template sub[x]''''''[x]''''''] diff --git a/doc/quickbook/permutation_iterator.qbk b/doc/quickbook/permutation_iterator.qbk index 81352b6e0..460ddc591 100644 --- a/doc/quickbook/permutation_iterator.qbk +++ b/doc/quickbook/permutation_iterator.qbk @@ -84,18 +84,18 @@ The output is: The source code for this example can be found -[@../example/permutation_iter_example.cpp here]. +[example_link permutation_iter_example.cpp..here]. [h2 Reference] [h3 Synopsis] template< class ElementIterator - , class IndexIterator - , class ValueT = use_default - , class CategoryT = use_default - , class ReferenceT = use_default - , class DifferenceT = use_default > + , class IndexIterator + , class ValueT = use_default + , class CategoryT = use_default + , class ReferenceT = use_default + , class DifferenceT = use_default > class permutation_iterator { public: @@ -104,10 +104,10 @@ The source code for this example can be found template< class OEIter, class OIIter, class V, class C, class R, class D > permutation_iterator( - permutation_iterator const& r - , typename enable_if_convertible::type* = 0 - , typename enable_if_convertible::type* = 0 - ); + permutation_iterator const& r + , typename enable_if_convertible::type* = 0 + , typename enable_if_convertible::type* = 0 + ); reference operator*() const; permutation_iterator& operator++(); ElementIterator const& base() const; @@ -173,10 +173,10 @@ following operations. template< class OEIter, class OIIter, class V, class C, class R, class D > permutation_iterator( - permutation_iterator const& r - , typename enable_if_convertible::type* = 0 - , typename enable_if_convertible::type* = 0 - ); + permutation_iterator const& r + , typename enable_if_convertible::type* = 0 + , typename enable_if_convertible::type* = 0 + ); [*Effects: ] Constructs `m_elt` from `r.m_elt` and `m_order` from `y.m_order`. @@ -204,4 +204,4 @@ following operations. [*Returns: ] `permutation_iterator(e, i)` -[endsect] \ No newline at end of file +[endsect] diff --git a/doc/quickbook/reverse_iterator.qbk b/doc/quickbook/reverse_iterator.qbk index 2599105f8..8b8a6ff3a 100644 --- a/doc/quickbook/reverse_iterator.qbk +++ b/doc/quickbook/reverse_iterator.qbk @@ -41,7 +41,7 @@ The output is: The source code for this example can be found -[@../example/reverse_iterator_example.cpp here]. +[example_link reverse_iterator_example.cpp..here]. [h2 Reference] diff --git a/doc/quickbook/shared_container_iterator.qbk b/doc/quickbook/shared_container_iterator.qbk index d48658c24..c8fe4c636 100644 --- a/doc/quickbook/shared_container_iterator.qbk +++ b/doc/quickbook/shared_container_iterator.qbk @@ -56,7 +56,7 @@ original shared pointer `ints` ceases to exist after `set_range()` returns, the `shared_counter_iterator` objects maintain references to the underlying vector and thereby extend the container's lifetime. -[@../../example/shared_iterator_example1.cpp `shared_iterator_example1.cpp`]: +[example_link shared_iterator_example1.cpp..`shared_iterator_example1.cpp`]: #include "shared_container_iterator.hpp" #include "boost/shared_ptr.hpp" @@ -139,7 +139,7 @@ explicitly specifying its type. This example, similar to the previous, uses `make_shared_container_iterator()` to create the iterators. -[@../../example/shared_iterator_example2.cpp `shared_iterator_example2.cpp`]: +[example_link shared_iterator_example2.cpp..`shared_iterator_example2.cpp`]: #include "shared_container_iterator.hpp" #include "boost/shared_ptr.hpp" @@ -200,7 +200,7 @@ named. The output from this example is the same as the previous. In the following example, a range of values is returned as a pair of shared_container_iterator objects. -[@../../example/shared_iterator_example3.cpp `shared_iterator_example3.cpp`]: +[example_link shared_iterator_example3.cpp..`shared_iterator_example3.cpp`]: #include "shared_container_iterator.hpp" #include "boost/shared_ptr.hpp" diff --git a/doc/quickbook/transform_iterator.qbk b/doc/quickbook/transform_iterator.qbk index 847ec79ce..e4b1d563a 100644 --- a/doc/quickbook/transform_iterator.qbk +++ b/doc/quickbook/transform_iterator.qbk @@ -44,7 +44,7 @@ The output is: The source code for this example can be found -[@../example/transform_iterator_example.cpp here]. +[example_link transform_iterator_example.cpp..here]. [h2 Reference] From 3a8728a59529bd31e1fba578f5e14325ce422026 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 12 Dec 2019 12:35:38 +0300 Subject: [PATCH 020/173] Whitespace cleanup and formatting fixes in docs. --- doc/quickbook/adaptor.qbk | 27 +++---- doc/quickbook/archetypes.qbk | 32 ++++---- doc/quickbook/concepts.qbk | 5 +- doc/quickbook/counting_iterator.qbk | 31 ++++---- doc/quickbook/facade.qbk | 1 - doc/quickbook/facade_tutorial.qbk | 25 +++--- doc/quickbook/filter_iterator.qbk | 30 ++++--- doc/quickbook/function_output_iterator.qbk | 9 +-- doc/quickbook/indirect_iterator.qbk | 29 +++---- doc/quickbook/iterator.qbk | 1 - doc/quickbook/iterator_traits.qbk | 1 - doc/quickbook/permutation_iterator.qbk | 28 +++---- doc/quickbook/reverse_iterator.qbk | 17 ++-- doc/quickbook/shared_container_iterator.qbk | 87 +++++++++++---------- doc/quickbook/specialized_adaptors.qbk | 3 +- doc/quickbook/transform_iterator.qbk | 74 +++++++++--------- doc/quickbook/zip_iterator.qbk | 49 ++++++------ 17 files changed, 219 insertions(+), 230 deletions(-) diff --git a/doc/quickbook/adaptor.qbk b/doc/quickbook/adaptor.qbk index 0cf435e3f..849b2a098 100644 --- a/doc/quickbook/adaptor.qbk +++ b/doc/quickbook/adaptor.qbk @@ -1,4 +1,3 @@ - [section:adaptor Iterator Adaptor] The `iterator_adaptor` class template adapts some `Base` [#base]_ @@ -47,7 +46,7 @@ that assumption. , class Reference = use_default , class Difference = use_default > - class iterator_adaptor + class iterator_adaptor : public iterator_facade // see details { friend class iterator_core_access; @@ -60,21 +59,21 @@ that assumption. typedef iterator_adaptor iterator_adaptor\_; Base const& base_reference() const; Base& base_reference(); - private: // Core iterator interface for iterator_facade. + private: // Core iterator interface for iterator_facade. typename iterator_adaptor::reference dereference() const; template < - class OtherDerived, class OtherIterator, class V, class C, class R, class D - > + class OtherDerived, class OtherIterator, class V, class C, class R, class D + > bool equal(iterator_adaptor const& x) const; - + void advance(typename iterator_adaptor::difference_type n); void increment(); void decrement(); template < class OtherDerived, class OtherIterator, class V, class C, class R, class D - > + > typename iterator_adaptor::difference_type distance_to( iterator_adaptor const& y) const; @@ -133,7 +132,7 @@ above are defined as follows: iterator_adaptor(); [*Requires:] The `Base` type must be Default Constructible.[br] -[*Returns:] An instance of `iterator_adaptor` with +[*Returns:] An instance of `iterator_adaptor` with `m_iterator` default constructed. @@ -167,7 +166,7 @@ above are defined as follows: template < class OtherDerived, class OtherIterator, class V, class C, class R, class D - > + > bool equal(iterator_adaptor const& x) const; [*Returns:] `m_iterator == x.base()` @@ -188,7 +187,7 @@ above are defined as follows: template < class OtherDerived, class OtherIterator, class V, class C, class R, class D - > + > typename iterator_adaptor::difference_type distance_to( iterator_adaptor const& y) const; @@ -229,7 +228,7 @@ operations on the underlying pointer, via the `node_iterator`\ 's |dereference_and_equal|_). The only real behavioral difference between `node_base*` and `node_iterator` can be observed when they are incremented: `node_iterator` follows the -`m_next` pointer, while `node_base*` just applies an address offset. +`m_next` pointer, while `node_base*` just applies an address offset. .. |dereference_and_equal| replace:: `dereference` and `equal` member functions .. _dereference_and_equal: iterator_facade.html#implementing-the-core-operations @@ -287,7 +286,7 @@ this technique is known not to work with Borland C++ 5.6.4 and Metrowerks CodeWarrior versions prior to 9.0] You can see an example program that exercises this version of the -node iterators +node iterators [example_link node_iterator3.cpp..here]. @@ -306,7 +305,7 @@ types to its `Base` saves the implementor of std::iterator_traits::*some-associated-type* -at least four times. +at least four times. We urge you to review the documentation and implementations of |reverse_iterator|_ and the other Boost `specialized iterator @@ -330,4 +329,4 @@ __ index.html#specialized-adaptors [endsect] -[endsect] \ No newline at end of file +[endsect] diff --git a/doc/quickbook/archetypes.qbk b/doc/quickbook/archetypes.qbk index 71821f3eb..bbd3ea123 100644 --- a/doc/quickbook/archetypes.qbk +++ b/doc/quickbook/archetypes.qbk @@ -1,4 +1,3 @@ - [section:archetypes Iterator Archetypes] The `iterator_archetype` class constructs a minimal implementation of @@ -41,23 +40,23 @@ The access category types provided correspond to the following standard iterator access concept combinations: readable_iterator_t := - + Readable Iterator writable_iterator_t := - + Writeable Iterator readable_writable_iterator_t := - + Readable Iterator & Writeable Iterator & Swappable Iterator readable_lvalue_iterator_t := - + Readable Iterator & Lvalue Iterator writeable_lvalue_iterator_t := - + Readable Iterator & Writeable Iterator & Swappable Iterator & Lvalue Iterator [h3 Traits] @@ -66,25 +65,25 @@ The nested trait types are defined as follows: if (AccessCategory == readable_iterator_t) - + value_type = Value reference = Value pointer = Value* else if (AccessCategory == writable_iterator_t) - + value_type = void reference = void pointer = void else if (AccessCategory == readable_writable_iterator_t) - + value_type = Value reference := A type X that is convertible to Value for which the following - expression is valid. Given an object x of type X and v of type + expression is valid. Given an object x of type X and v of type Value. x = v @@ -92,13 +91,13 @@ The nested trait types are defined as follows: pointer = Value* else if (AccessCategory == readable_lvalue_iterator_t) - + value_type = Value reference = Value const& pointer = Value const* else if (AccessCategory == writable_lvalue_iterator_t) - + value_type = Value reference = Value& pointer = Value* @@ -108,11 +107,11 @@ The nested trait types are defined as follows: difference_type := ptrdiff_t else - + difference_type := unspecified type - - iterator_category := + + iterator_category := A type X satisfying the following two constraints: @@ -156,5 +155,4 @@ the iterator concept specified by `AccessCategory` and arguments. `iterator_archetype` does not model any other access concepts or any more derived traversal concepts. - -[endsect] \ No newline at end of file +[endsect] diff --git a/doc/quickbook/concepts.qbk b/doc/quickbook/concepts.qbk index a36992f49..1e190576c 100644 --- a/doc/quickbook/concepts.qbk +++ b/doc/quickbook/concepts.qbk @@ -1,4 +1,3 @@ - [section:concepts Iterator Concepts] [section:access Access] @@ -326,13 +325,13 @@ constant object of type `Distance`. [pre: there exists a value `n` of `Distance` such that `a + n == b`. `b == a + (b - a)`.] ] [ - [`a\[n\]`] + [`a[n]`] [convertible to T] [`*(a + n)`] [pre: a is a *Readable Iterator*] ] [ - [`a\[n\] = v`] + [`a[n] = v`] [convertible to T] [`*(a + n) = v`] [pre: a is a *Writable iterator*] diff --git a/doc/quickbook/counting_iterator.qbk b/doc/quickbook/counting_iterator.qbk index f661c407f..7fdff9efd 100644 --- a/doc/quickbook/counting_iterator.qbk +++ b/doc/quickbook/counting_iterator.qbk @@ -1,4 +1,3 @@ - [section:counting Counting Iterator] A `counting_iterator` adapts an object by adding an `operator*` that @@ -18,26 +17,28 @@ into the first array via indirection through the second array. std::vector numbers; typedef std::vector::iterator n_iter; std::copy(boost::counting_iterator(0), - boost::counting_iterator(N), - std::back_inserter(numbers)); + boost::counting_iterator(N), + std::back_inserter(numbers)); std::vector::iterator> pointers; std::copy(boost::make_counting_iterator(numbers.begin()), - boost::make_counting_iterator(numbers.end()), - std::back_inserter(pointers)); + boost::make_counting_iterator(numbers.end()), + std::back_inserter(pointers)); - std::cout << "indirectly printing out the numbers from 0 to " - << N << std::endl; + std::cout << "indirectly printing out the numbers from 0 to " + << N << std::endl; std::copy(boost::make_indirect_iterator(pointers.begin()), - boost::make_indirect_iterator(pointers.end()), - std::ostream_iterator(std::cout, " ")); + boost::make_indirect_iterator(pointers.end()), + std::ostream_iterator(std::cout, " ")); std::cout << std::endl; The output is: - indirectly printing out the numbers from 0 to 7 - 0 1 2 3 4 5 6 +[pre +indirectly printing out the numbers from 0 to 7 +0 1 2 3 4 5 6 +] The source code for this example can be found [example_link counting_iterator_example.cpp..here]. @@ -86,9 +87,9 @@ algorithm: random_access_traversal_tag, Incrementable, const Incrementable&) else return |iterator-category|_\ ( - iterator_traversal::type, + iterator_traversal::type, Incrementable, const Incrementable&) - + [blurb *Note:* implementers are encouraged to provide an implementation of `operator-` and a `difference_type` that avoids overflows in the cases where `std::numeric_limits::is_specialized` @@ -181,7 +182,7 @@ operations. counting_iterator& operator--(); [*Effects: ] `--m_inc`[br] -[*Returns: ] `*this` +[*Returns: ] `*this` Incrementable const& base() const; @@ -189,4 +190,4 @@ operations. [*Returns: ] `m_inc` -[endsect] \ No newline at end of file +[endsect] diff --git a/doc/quickbook/facade.qbk b/doc/quickbook/facade.qbk index 7ca38096e..4e029b0ff 100644 --- a/doc/quickbook/facade.qbk +++ b/doc/quickbook/facade.qbk @@ -1,4 +1,3 @@ - [section:facade Iterator Facade] While the iterator interface is rich, there is a core subset of the diff --git a/doc/quickbook/facade_tutorial.qbk b/doc/quickbook/facade_tutorial.qbk index cb6428273..08b18acf2 100644 --- a/doc/quickbook/facade_tutorial.qbk +++ b/doc/quickbook/facade_tutorial.qbk @@ -1,12 +1,11 @@ - [section:facade_tutorial Tutorial] In this section we'll walk through the implementation of a few iterators using `iterator_facade`, based around the simple example of a linked list of polymorphic objects. This example was -inspired by a +inspired by a [@http://thread.gmane.org/gmane.comp.lib.boost.user/5100 `posting`] -by Keith Macdonald on the +by Keith Macdonald on the [@http://www.boost.org/more/mailing_lists.htm#users `Boost-Users`] mailing list. @@ -30,16 +29,16 @@ Say we've written a polymorphic linked list node base class: // print to the stream virtual void print(std::ostream& s) const = 0; - + // double the value virtual void double_me() = 0; void append(node_base* p) { - if (m_next) - m_next->append(p); + if (m_next) + m_next->append(p); else - m_next = p; + m_next = p; } private: @@ -210,7 +209,7 @@ the concepts we want our iterator to model. Referring to the table__, we can see that the first three rows are applicable because `node_iterator` needs to satisfy the requirements for `readable iterator`_, `single pass iterator`_, and `incrementable -iterator`_. +iterator`_. __ `core operations`_ @@ -254,7 +253,7 @@ make them private and grant friendship to }; Voila; a complete and conforming readable, forward-traversal -iterator! For a working example of its use, see +iterator! For a working example of its use, see [example_link node_iterator1.cpp..this program]. __ ../../example/node_iterator1.cpp @@ -265,7 +264,7 @@ __ ../../example/node_iterator1.cpp The term **mutable iterator** means an iterator through which the object it references (its "referent") can be modified. A **constant iterator** is one which doesn't allow modification of -its referent.[br][br] +its referent.[br][br] The words *constant* and *mutable* don't refer to the ability to modify the iterator itself. For example, an `int const*` is a non-\ `const` *constant iterator*, which can be incremented @@ -402,7 +401,7 @@ adding a templatized converting constructor [#broken]_ [#random]_: template bool equal(node_iter const& other) const - { + { return this->m_node == other.m_node; } @@ -431,7 +430,7 @@ adding a templatized converting constructor [#broken]_ [#random]_: __ ../../example/node_iterator2.hpp You can see an example program which exercises our interoperable -iterators +iterators [example_link node_iterator2.cpp..here]. @@ -467,7 +466,7 @@ appropriate: ... - private: + private: struct enabler {}; public: diff --git a/doc/quickbook/filter_iterator.qbk b/doc/quickbook/filter_iterator.qbk index c536d5b4a..f21200301 100644 --- a/doc/quickbook/filter_iterator.qbk +++ b/doc/quickbook/filter_iterator.qbk @@ -1,4 +1,3 @@ - [section:filter Filter Iterator] The filter iterator adaptor creates a view of an iterator range in @@ -19,7 +18,6 @@ This example uses `filter_iterator` and then array of integers. Then `make_filter_iterator` is is used to output the integers greater than `-2`. - struct is_positive_number { bool operator()(int x) { return 0 < x; } }; @@ -33,7 +31,7 @@ the integers greater than `-2`. base_iterator numbers(numbers_); // Example using filter_iterator - typedef boost::filter_iterator + typedef boost::filter_iterator FilterIter; is_positive_number predicate; @@ -70,10 +68,11 @@ the integers greater than `-2`. The output is: - 4 5 8 - 4 5 8 - 0 -1 4 5 8 - +[pre +4 5 8 +4 5 8 +0 -1 4 5 8 +] The source code for this example can be found [example_link filter_iterator_example.cpp..here]. @@ -114,10 +113,10 @@ The source code for this example can be found [example_link filter_iterator_exam If `Iterator` models Readable Lvalue Iterator and Bidirectional Traversal Iterator then `iterator_category` is convertible to -`std::bidirectional_iterator_tag`. +`std::bidirectional_iterator_tag`. Otherwise, if `Iterator` models Readable Lvalue Iterator and Forward Traversal Iterator then `iterator_category` is convertible to -`std::forward_iterator_tag`. +`std::forward_iterator_tag`. Otherwise `iterator_category` is convertible to `std::input_iterator_tag`. @@ -164,7 +163,7 @@ following tables. [[Writable Lvalue Iterator, Bidirectional Iterator ][Mutable Bidirectional Iterator]] ] -`filter_iterator` is interoperable with `filter_iterator` +`filter_iterator` is interoperable with `filter_iterator` if and only if `X` is interoperable with `Y`. @@ -179,14 +178,14 @@ operations. filter_iterator(); [*Requires: ]`Predicate` and `Iterator` must be Default Constructible.[br] -[*Effects: ] Constructs a `filter_iterator` whose`m_pred`, `m_iter`, and `m_end` +[*Effects: ] Constructs a `filter_iterator` whose`m_pred`, `m_iter`, and `m_end` members are a default constructed. filter_iterator(Predicate f, Iterator x, Iterator end = Iterator()); [*Effects: ] Constructs a `filter_iterator` where `m_iter` is either - the first position in the range `[x,end)` such that `f(*m_iter) == true` + the first position in the range `[x,end)` such that `f(*m_iter) == true` or else`m_iter == end`. The member `m_pred` is constructed from `f` and `m_end` from `end`. @@ -197,7 +196,7 @@ operations. [*Requires: ] `Predicate` must be Default Constructible and `Predicate` is a class type (not a function pointer).[br] [*Effects: ] Constructs a `filter_iterator` where `m_iter` is either - the first position in the range `[x,end)` such that `m_pred(*m_iter) == true` + the first position in the range `[x,end)` such that `m_pred(*m_iter) == true` or else`m_iter == end`. The member `m_pred` is default constructed. @@ -236,7 +235,6 @@ operations. [*Effects: ] Increments `m_iter` and then continues to increment `m_iter` until either `m_iter == m_end` or `m_pred(*m_iter) == true`.[br] -[*Returns: ] `*this` - +[*Returns: ] `*this` -[endsect] \ No newline at end of file +[endsect] diff --git a/doc/quickbook/function_output_iterator.qbk b/doc/quickbook/function_output_iterator.qbk index 838ebdeb2..914db7d06 100644 --- a/doc/quickbook/function_output_iterator.qbk +++ b/doc/quickbook/function_output_iterator.qbk @@ -1,4 +1,3 @@ - [section:function_output Function Output Iterator] The function output iterator adaptor makes it easier to create custom @@ -34,7 +33,7 @@ proxy object. x.push_back("!"); std::string s = ""; - std::copy(x.begin(), x.end(), + std::copy(x.begin(), x.end(), boost::make_function_output_iterator(string_appender(s))); std::cout << s << std::endl; @@ -68,7 +67,7 @@ proxy object. [h3 Requirements] -`UnaryFunction` must be Assignable and Copy Constructible. +`UnaryFunction` must be Assignable and Copy Constructible. [h3 Concepts] @@ -79,14 +78,14 @@ Incrementable Iterator concepts. explicit function_output_iterator(const UnaryFunction& f = UnaryFunction()); -[*Effects: ] Constructs an instance of `function_output_iterator` +[*Effects: ] Constructs an instance of `function_output_iterator` with `m_f` constructed from `f`. unspecified_type operator*(); [*Returns: ] An object `r` of unspecified type such that `r = t` is equivalent to `m_f(t)` for all `t`. - + function_output_iterator& operator++(); diff --git a/doc/quickbook/indirect_iterator.qbk b/doc/quickbook/indirect_iterator.qbk index 22589be39..06623f9e8 100644 --- a/doc/quickbook/indirect_iterator.qbk +++ b/doc/quickbook/indirect_iterator.qbk @@ -49,29 +49,30 @@ using the `make_indirect_iterator` helper function. const_indirect_last(pointers_to_chars + N); std::transform(const_indirect_first, const_indirect_last, - mutable_indirect_first, std::bind1st(std::plus(), 1)); + mutable_indirect_first, std::bind1st(std::plus(), 1)); std::copy(mutable_indirect_first, mutable_indirect_last, - std::ostream_iterator(std::cout, ",")); + std::ostream_iterator(std::cout, ",")); std::cout << std::endl; // Example of using make_indirect_iterator() - std::copy(boost::make_indirect_iterator(pointers_to_chars), - boost::make_indirect_iterator(pointers_to_chars + N), - std::ostream_iterator(std::cout, ",")); + std::copy(boost::make_indirect_iterator(pointers_to_chars), + boost::make_indirect_iterator(pointers_to_chars + N), + std::ostream_iterator(std::cout, ",")); std::cout << std::endl; The output is: - a,b,c,d,e,f,g, - b,c,d,e,f,g,h, - a,b,c,d,e,f,g, - +[pre +a,b,c,d,e,f,g, +b,c,d,e,f,g,h, +a,b,c,d,e,f,g, +] -The source code for this example can be found +The source code for this example can be found [example_link indirect_iterator_example.cpp..here]. @@ -136,9 +137,9 @@ the following pseudo-code, where `V` is else typedef Reference reference; - if (Value is use_default) then + if (Value is use_default) then typedef pointee::type\* pointer; - else + else typedef Value\* pointer; if (Difference is use_default) @@ -203,7 +204,7 @@ following operations: indirect_iterator(); [*Requires: ] `Iterator` must be Default Constructible.[br] -[*Effects: ] Constructs an instance of `indirect_iterator` with +[*Effects: ] Constructs an instance of `indirect_iterator` with a default-constructed `m_iterator`. @@ -225,7 +226,7 @@ following operations: ); [*Requires: ] `Iterator2` is implicitly convertible to `Iterator`.[br] -[*Effects: ] Constructs an instance of `indirect_iterator` whose +[*Effects: ] Constructs an instance of `indirect_iterator` whose `m_iterator` subobject is constructed from `y.base()`. diff --git a/doc/quickbook/iterator.qbk b/doc/quickbook/iterator.qbk index 8fff64c77..a653d14f3 100644 --- a/doc/quickbook/iterator.qbk +++ b/doc/quickbook/iterator.qbk @@ -305,4 +305,3 @@ library you see today. Patterns, C++ Report, February 1995, pp. 24-27.] [endsect] - diff --git a/doc/quickbook/iterator_traits.qbk b/doc/quickbook/iterator_traits.qbk index 16a816458..90a48e892 100644 --- a/doc/quickbook/iterator_traits.qbk +++ b/doc/quickbook/iterator_traits.qbk @@ -1,4 +1,3 @@ - [section:iterator_traits Iterator Traits] `std::iterator_traits` provides access to five associated types diff --git a/doc/quickbook/permutation_iterator.qbk b/doc/quickbook/permutation_iterator.qbk index 460ddc591..ce128180e 100644 --- a/doc/quickbook/permutation_iterator.qbk +++ b/doc/quickbook/permutation_iterator.qbk @@ -1,4 +1,3 @@ - [section:permutation Permutation Iterator] The permutation iterator adaptor provides a permuted view of a given @@ -35,7 +34,7 @@ past-the-end iterator to the indices. *el_it = std::distance(elements.begin(), el_it); index_type indices( index_size ); - for(index_type::iterator i_it = indices.begin() ; i_it != indices.end() ; ++i_it ) + for(index_type::iterator i_it = indices.begin() ; i_it != indices.end() ; ++i_it ) *i_it = element_range_size - index_size + std::distance(indices.begin(), i_it); std::reverse( indices.begin(), indices.end() ); @@ -75,13 +74,14 @@ past-the-end iterator to the indices. The output is: - The original range is : 0 1 2 3 4 5 6 7 8 9 - The reindexing scheme is : 9 8 7 6 - The permutated range is : 9 8 7 6 - Elements at even indices in the permutation : 9 7 - Permutation backwards : 6 7 8 9 - Iterate backward with stride 2 : 6 8 - +[pre +The original range is : 0 1 2 3 4 5 6 7 8 9 +The reindexing scheme is : 9 8 7 6 +The permutated range is : 9 8 7 6 +Elements at even indices in the permutation : 9 7 +Permutation backwards : 6 7 8 9 +Iterate backward with stride 2 : 6 8 +] The source code for this example can be found [example_link permutation_iter_example.cpp..here]. @@ -117,7 +117,7 @@ The source code for this example can be found }; template - permutation_iterator + permutation_iterator make_permutation_iterator( ElementIterator e, IndexIterator i); @@ -134,15 +134,15 @@ the `IndexIterator` must be convertible to the difference type of as `IndexIterator` and the same iterator access concepts as `ElementIterator`. -If `IndexIterator` models Single Pass Iterator and +If `IndexIterator` models Single Pass Iterator and `ElementIterator` models Readable Iterator then `permutation_iterator` models Input Iterator. -If `IndexIterator` models Forward Traversal Iterator and +If `IndexIterator` models Forward Traversal Iterator and `ElementIterator` models Readable Lvalue Iterator then `permutation_iterator` models Forward Iterator. -If `IndexIterator` models Bidirectional Traversal Iterator and +If `IndexIterator` models Bidirectional Traversal Iterator and `ElementIterator` models Readable Lvalue Iterator then `permutation_iterator` models Bidirectional Iterator. @@ -199,7 +199,7 @@ following operations. template - permutation_iterator + permutation_iterator make_permutation_iterator(ElementIterator e, IndexIterator i); [*Returns: ] `permutation_iterator(e, i)` diff --git a/doc/quickbook/reverse_iterator.qbk b/doc/quickbook/reverse_iterator.qbk index 8b8a6ff3a..22257cdbf 100644 --- a/doc/quickbook/reverse_iterator.qbk +++ b/doc/quickbook/reverse_iterator.qbk @@ -1,4 +1,3 @@ - [section:reverse Reverse Iterator] The reverse iterator adaptor iterates through the adapted iterator @@ -9,7 +8,6 @@ range in the opposite direction. The following example prints an array of characters in reverse order using `reverse_iterator`. - char letters_[] = "hello world!"; const int N = sizeof(letters_)/sizeof(char) - 1; typedef char* base_iterator; @@ -35,10 +33,11 @@ using `reverse_iterator`. The output is: - original sequence of letters: hello world! - sequence in reverse order: !dlrow olleh - sequence in double-reversed (normal) order: hello world! - +[pre +original sequence of letters: hello world! +sequence in reverse order: !dlrow olleh +sequence in double-reversed (normal) order: hello world! +] The source code for this example can be found [example_link reverse_iterator_example.cpp..here]. @@ -116,7 +115,7 @@ operations. reverse_iterator(); [*Requires: ] `Iterator` must be Default Constructible.[br] -[*Effects: ] Constructs an instance of `reverse_iterator` with `m_iterator` +[*Effects: ] Constructs an instance of `reverse_iterator` with `m_iterator` default constructed. explicit reverse_iterator(Iterator x); @@ -132,7 +131,7 @@ operations. ); [*Requires: ] `OtherIterator` is implicitly convertible to `Iterator`.[br] -[*Effects: ] Constructs instance of `reverse_iterator` whose +[*Effects: ] Constructs instance of `reverse_iterator` whose `m_iterator` subobject is constructed from `y.base()`. @@ -157,4 +156,4 @@ operations. [*Effects: ] `++m_iterator`[br] [*Returns: ] `*this` -[endsect] \ No newline at end of file +[endsect] diff --git a/doc/quickbook/shared_container_iterator.qbk b/doc/quickbook/shared_container_iterator.qbk index c8fe4c636..b87678abe 100644 --- a/doc/quickbook/shared_container_iterator.qbk +++ b/doc/quickbook/shared_container_iterator.qbk @@ -1,4 +1,3 @@ - [section:shared_container Shared Container Iterator] Defined in header [@../../../boost/shared_container_iterator.hpp `boost/shared_container_iterator.hpp`]. @@ -27,12 +26,12 @@ iterator. namespace boost { template class shared_container_iterator; - + template shared_container_iterator - make_shared_container_iterator(typename Container::iterator base, + make_shared_container_iterator(typename Container::iterator base, boost::shared_ptr const& container); - + std::pair< typename shared_container_iterator, typename shared_container_iterator @@ -46,7 +45,7 @@ iterator. The class template `shared_container_iterator` is the shared container iterator type. The `Container` template type argument must model the -[@http://www.sgi.com/tech/stl/Container.html Container] concept. +[@http://www.sgi.com/tech/stl/Container.html Container] concept. [h2 Example] @@ -63,41 +62,43 @@ the underlying vector and thereby extend the container's lifetime. #include #include #include - + typedef boost::shared_container_iterator< std::vector > iterator; - - + + void set_range(iterator& i, iterator& end) { - + boost::shared_ptr< std::vector > ints(new std::vector()); - + ints->push_back(0); ints->push_back(1); ints->push_back(2); ints->push_back(3); ints->push_back(4); ints->push_back(5); - + i = iterator(ints->begin(),ints); end = iterator(ints->end(),ints); } - - + + int main() { - + iterator i,end; - + set_range(i,end); - + std::copy(i,end,std::ostream_iterator(std::cout,",")); std::cout.put('\n'); - + return 0; } The output from this part is: - 0,1,2,3,4,5, +[pre +0,1,2,3,4,5, +] [table Template Parameters [[Parameter][Description]] @@ -130,13 +131,13 @@ iterator will be valid. In addition it has the following constructor: boost::shared_ptr const& container) This function provides an alternative to directly constructing a -`shared_container_iterator`. Using the object generator, a +`shared_container_iterator`. Using the object generator, a `shared_container_iterator` can be created and passed to a function without explicitly specifying its type. [h2 Example] -This example, similar to the previous, +This example, similar to the previous, uses `make_shared_container_iterator()` to create the iterators. [example_link shared_iterator_example2.cpp..`shared_iterator_example2.cpp`]: @@ -147,35 +148,35 @@ uses `make_shared_container_iterator()` to create the iterators. #include #include #include - - + + template void print_range_nl (Iterator begin, Iterator end) { typedef typename std::iterator_traits::value_type val; std::copy(begin,end,std::ostream_iterator(std::cout,",")); std::cout.put('\n'); } - - + + int main() { - + typedef boost::shared_ptr< std::vector > ints_t; { ints_t ints(new std::vector()); - + ints->push_back(0); ints->push_back(1); ints->push_back(2); ints->push_back(3); ints->push_back(4); ints->push_back(5); - + print_range_nl(boost::make_shared_container_iterator(ints->begin(),ints), boost::make_shared_container_iterator(ints->end(),ints)); } - - - + + + return 0; } @@ -206,12 +207,12 @@ In the following example, a range of values is returned as a pair of shared_cont #include "boost/shared_ptr.hpp" #include "boost/tuple/tuple.hpp" // for boost::tie #include // for std::copy - #include + #include #include - - - typedef boost::shared_container_iterator< std::vector > iterator; - + + + typedef boost::shared_container_iterator< std::vector > iterator; + std::pair return_range() { boost::shared_ptr< std::vector > range(new std::vector()); @@ -223,18 +224,18 @@ In the following example, a range of values is returned as a pair of shared_cont range->push_back(5); return boost::make_shared_container_range(range); } - - + + int main() { - - + + iterator i,end; - + boost::tie(i,end) = return_range(); - + std::copy(i,end,std::ostream_iterator(std::cout,",")); std::cout.put('\n'); - + return 0; } @@ -245,4 +246,4 @@ the same as the previous two. [endsect] -[endsect] \ No newline at end of file +[endsect] diff --git a/doc/quickbook/specialized_adaptors.qbk b/doc/quickbook/specialized_adaptors.qbk index 2b8b868d3..4f3c67a7d 100644 --- a/doc/quickbook/specialized_adaptors.qbk +++ b/doc/quickbook/specialized_adaptors.qbk @@ -1,4 +1,3 @@ - [section:specialized Specialized Adaptors] [include ./counting_iterator.qbk] @@ -19,4 +18,4 @@ [include ./zip_iterator.qbk] -[endsect] \ No newline at end of file +[endsect] diff --git a/doc/quickbook/transform_iterator.qbk b/doc/quickbook/transform_iterator.qbk index e4b1d563a..e4a6a3ea4 100644 --- a/doc/quickbook/transform_iterator.qbk +++ b/doc/quickbook/transform_iterator.qbk @@ -1,4 +1,3 @@ - [section:transform Transform Iterator] The transform iterator adapts an iterator by modifying the @@ -14,36 +13,37 @@ generate iterators that multiply (or add to) the value returned by dereferencing the iterator. It would be cooler to use lambda library in this example. - int x[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; - const int N = sizeof(x)/sizeof(int); - - typedef boost::binder1st< std::multiplies > Function; - typedef boost::transform_iterator doubling_iterator; - - doubling_iterator i(x, boost::bind1st(std::multiplies(), 2)), - i_end(x + N, boost::bind1st(std::multiplies(), 2)); - - std::cout << "multiplying the array by 2:" << std::endl; - while (i != i_end) - std::cout << *i++ << " "; - std::cout << std::endl; - - std::cout << "adding 4 to each element in the array:" << std::endl; - std::copy(boost::make_transform_iterator(x, boost::bind1st(std::plus(), 4)), - boost::make_transform_iterator(x + N, boost::bind1st(std::plus(), 4)), - std::ostream_iterator(std::cout, " ")); - std::cout << std::endl; + int x[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; + const int N = sizeof(x)/sizeof(int); + typedef boost::binder1st< std::multiplies > Function; + typedef boost::transform_iterator doubling_iterator; -The output is: + doubling_iterator i(x, boost::bind1st(std::multiplies(), 2)), + i_end(x + N, boost::bind1st(std::multiplies(), 2)); + + std::cout << "multiplying the array by 2:" << std::endl; + while (i != i_end) + std::cout << *i++ << " "; + std::cout << std::endl; + + std::cout << "adding 4 to each element in the array:" << std::endl; + std::copy(boost::make_transform_iterator(x, boost::bind1st(std::plus(), 4)), + boost::make_transform_iterator(x + N, boost::bind1st(std::plus(), 4)), + std::ostream_iterator(std::cout, " ")); + std::cout << std::endl; - multiplying the array by 2: - 2 4 6 8 10 12 14 16 - adding 4 to each element in the array: - 5 6 7 8 9 10 11 12 +The output is: + +[pre +multiplying the array by 2: +2 4 6 8 10 12 14 16 +adding 4 to each element in the array: +5 6 7 8 9 10 11 12 +] -The source code for this example can be found +The source code for this example can be found [example_link transform_iterator_example.cpp..here]. [h2 Reference] @@ -52,8 +52,8 @@ The source code for this example can be found [h3 Synopsis] template class transform_iterator { @@ -116,7 +116,7 @@ where the type of `f(*i)` must be `result_of::reference)>::type`. -The argument `Iterator` shall model Readable Iterator. +The argument `Iterator` shall model Readable Iterator. [h3 Concepts] @@ -126,11 +126,11 @@ The resulting `transform_iterator` models the most refined of the following that is also modeled by `Iterator`. -* Writable Lvalue Iterator if `transform_iterator::reference` is a non-const reference. +* Writable Lvalue Iterator if `transform_iterator::reference` is a non-const reference. * Readable Lvalue Iterator if `transform_iterator::reference` is a const reference. -* Readable Iterator otherwise. +* Readable Iterator otherwise. The `transform_iterator` models the most refined standard traversal @@ -143,11 +143,11 @@ the `Iterator` argument models. [table Category - [[If `Iterator` models][then `transform_iterator` models]] - [[Single Pass Iterator][Input Iterator]] - [[Forward Traversal Iterator][Forward Iterator]] - [[Bidirectional Traversal Iterator][Bidirectional Iterator]] - [[Random Access Traversal Iterator][Random Access Iterator]] +[[If `Iterator` models][then `transform_iterator` models]] +[[Single Pass Iterator][Input Iterator]] +[[Forward Traversal Iterator][Forward Iterator]] +[[Bidirectional Traversal Iterator][Bidirectional Iterator]] +[[Random Access Traversal Iterator][Random Access Iterator]] ] If `transform_iterator` models Writable Lvalue Iterator then it is a @@ -177,7 +177,7 @@ operations: template transform_iterator( transform_iterator const& t - , typename enable_if_convertible::type* = 0 // exposition only + , typename enable_if_convertible::type* = 0 // exposition only , typename enable_if_convertible::type* = 0 // exposition only ); diff --git a/doc/quickbook/zip_iterator.qbk b/doc/quickbook/zip_iterator.qbk index 63955387b..53daf8121 100644 --- a/doc/quickbook/zip_iterator.qbk +++ b/doc/quickbook/zip_iterator.qbk @@ -1,17 +1,16 @@ - [section:zip Zip Iterator] The zip iterator provides the ability to parallel-iterate -over several controlled sequences simultaneously. A zip +over several controlled sequences simultaneously. A zip iterator is constructed from a tuple of iterators. Moving the zip iterator moves all the iterators in parallel. Dereferencing the zip iterator returns a tuple that contains -the results of dereferencing the individual iterators. +the results of dereferencing the individual iterators. -The tuple of iterators is now implemented in terms of a Boost fusion sequence. +The tuple of iterators is now implemented in terms of a Boost fusion sequence. Because of this the 'tuple' may be any Boost fusion sequence and, for backwards -compatibility through a Boost fusion sequence adapter, a Boost tuple. Because the -'tuple' may be any boost::fusion sequence the 'tuple' may also be any type for which a +compatibility through a Boost fusion sequence adapter, a Boost tuple. Because the +'tuple' may be any boost::fusion sequence the 'tuple' may also be any type for which a Boost fusion adapter exists. This includes, among others, a std::tuple and a std::pair. Just remember to include the appropriate Boost fusion adapter header files for these other Boost fusion adapters. The zip_iterator header file already includes the @@ -22,9 +21,9 @@ to use a Boost tuple as your 'tuple'. There are two main types of applications of the `zip_iterator`. The first one concerns runtime efficiency: If one has several controlled sequences -of the same length that must be somehow processed, e.g., with the +of the same length that must be somehow processed, e.g., with the `for_each` algorithm, then it is more efficient to perform just -one parallel-iteration rather than several individual iterations. For an +one parallel-iteration rather than several individual iterations. For an example, assume that `vect_of_doubles` and `vect_of_ints` are two vectors of equal length containing doubles and ints, respectively, and consider the following two iterations: @@ -53,7 +52,7 @@ These two iterations can now be replaced with a single one as follows: A non-generic implementation of `zip_func` could look as follows: - struct zip_func : + struct zip_func : public std::unary_function&, void> { void operator()(const boost::tuple& t) const @@ -72,16 +71,16 @@ to make combining iterators. A combining iterator is an iterator that parallel-iterates over several controlled sequences and, upon dereferencing, returns the result of applying a functor to the values of the sequences at the respective positions. This can now be achieved by using the -`zip_iterator` in conjunction with the `transform_iterator`. +`zip_iterator` in conjunction with the `transform_iterator`. -Suppose, for example, that you have two vectors of doubles, say +Suppose, for example, that you have two vectors of doubles, say `vect_1` and `vect_2`, and you need to expose to a client -a controlled sequence containing the products of the elements of +a controlled sequence containing the products of the elements of `vect_1` and `vect_2`. Rather than placing these products in a third vector, you can use a combining iterator that calculates the products on the fly. Let us assume that `tuple_multiplies` is a functor that works like `std::multiplies`, except that it takes -its two arguments packaged in a tuple. Then the two iterators +its two arguments packaged in a tuple. Then the two iterators `it_begin` and `it_end` defined below delimit a controlled sequence containing the products of the elements of `vect_1` and `vect_2`: @@ -128,7 +127,7 @@ sequence containing the products of the elements of `vect_1` and template class zip_iterator - { + { public: typedef /* see below */ reference; @@ -154,8 +153,8 @@ sequence containing the products of the elements of `vect_1` and IteratorTuple m_iterator_tuple; // exposition only }; - template - zip_iterator + template + zip_iterator make_zip_iterator(IteratorTuple t); The `reference` member of `zip_iterator` is the type of the tuple @@ -168,23 +167,23 @@ of the first of the iterator types in the `IteratorTuple` argument. The `iterator_category` member of `zip_iterator` is convertible to the minimum of the traversal categories of the iterator types in the `IteratorTuple` argument. For example, if the `zip_iterator` holds only vector -iterators, then `iterator_category` is convertible to +iterators, then `iterator_category` is convertible to `boost::random_access_traversal_tag`. If you add a list iterator, then `iterator_category` will be convertible to `boost::bidirectional_traversal_tag`, but no longer to `boost::random_access_traversal_tag`. [h2 Requirements] -All iterator types in the argument `IteratorTuple` shall model Readable Iterator. +All iterator types in the argument `IteratorTuple` shall model Readable Iterator. [h2 Concepts] The resulting `zip_iterator` models Readable Iterator. -The fact that the `zip_iterator` models only Readable Iterator does not +The fact that the `zip_iterator` models only Readable Iterator does not prevent you from modifying the values that the individual iterators point -to. The tuple returned by the `zip_iterator`'s `operator*` is a tuple -constructed from the reference types of the individual iterators, not +to. The tuple returned by the `zip_iterator`'s `operator*` is a tuple +constructed from the reference types of the individual iterators, not their value types. For example, if `zip_it` is a `zip_iterator` whose first member iterator is an `std::vector::iterator`, then the following line will modify the value which the first member iterator of @@ -195,7 +194,7 @@ following line will modify the value which the first member iterator of Consider the set of standard traversal concepts obtained by taking the most refined standard traversal concept modeled by each individual -iterator type in the `IteratorTuple` argument.The `zip_iterator` +iterator type in the `IteratorTuple` argument.The `zip_iterator` models the least refined standard traversal concept in this set. `zip_iterator` is interoperable with @@ -254,8 +253,8 @@ operations. [*Effects:] Decrements each iterator in `m_iterator_tuple`.[br] [*Returns:] `*this` - template - zip_iterator + template + zip_iterator make_zip_iterator(IteratorTuple t); [*Returns:] An instance of `zip_iterator` with `m_iterator_tuple` @@ -263,4 +262,4 @@ operations. [endsect] -[endsect] \ No newline at end of file +[endsect] From fdcd8439c08c2239110d73d9ffb211ffabf3919a Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Wed, 18 Dec 2019 08:40:35 -0500 Subject: [PATCH 021/173] BOOST_ prefix include guard macro --- include/boost/shared_container_iterator.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/boost/shared_container_iterator.hpp b/include/boost/shared_container_iterator.hpp index e803bd654..8adcaf7ec 100644 --- a/include/boost/shared_container_iterator.hpp +++ b/include/boost/shared_container_iterator.hpp @@ -5,8 +5,8 @@ // See http://www.boost.org/libs/utility/shared_container_iterator.html for documentation. -#ifndef SHARED_CONTAINER_ITERATOR_RG08102002_HPP -#define SHARED_CONTAINER_ITERATOR_RG08102002_HPP +#ifndef BOOST_SHARED_CONTAINER_ITERATOR_HPP +#define BOOST_SHARED_CONTAINER_ITERATOR_HPP #include "boost/iterator_adaptors.hpp" #include "boost/shared_ptr.hpp" @@ -66,4 +66,4 @@ using iterators::make_shared_container_range; } // namespace boost -#endif // SHARED_CONTAINER_ITERATOR_RG08102002_HPP +#endif From 4fe679bb0db6ba77b3341d98b8605d3722901d78 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 4 Mar 2020 00:52:58 +0300 Subject: [PATCH 022/173] Updated lightweight_test.hpp includes to the new location. --- test/counting_iterator_test.cpp | 2 +- test/detail/zip_iterator_test.ipp | 2 +- test/generator_iterator_test.cpp | 2 +- test/indirect_iterator_test.cpp | 46 +++++++++++++++---------------- test/interoperable.cpp | 14 +++++----- test/iterator_adaptor_test.cpp | 2 +- test/iterator_traits_test.cpp | 2 +- 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/test/counting_iterator_test.cpp b/test/counting_iterator_test.cpp index 855ea2137..59caa0dc2 100644 --- a/test/counting_iterator_test.cpp +++ b/test/counting_iterator_test.cpp @@ -45,7 +45,7 @@ #endif #include #include -#include +#include #ifndef BOOST_NO_SLIST # ifdef BOOST_SLIST_HEADER # include BOOST_SLIST_HEADER diff --git a/test/detail/zip_iterator_test.ipp b/test/detail/zip_iterator_test.ipp index 7e9a78fa7..7e0d2f7b0 100644 --- a/test/detail/zip_iterator_test.ipp +++ b/test/detail/zip_iterator_test.ipp @@ -6,7 +6,7 @@ // // See http://www.boost.org for most recent version including documentation. -#include +#include #include #include diff --git a/test/generator_iterator_test.cpp b/test/generator_iterator_test.cpp index 1c7a11040..c31bd66ad 100644 --- a/test/generator_iterator_test.cpp +++ b/test/generator_iterator_test.cpp @@ -7,7 +7,7 @@ // #include -#include +#include #include class X diff --git a/test/indirect_iterator_test.cpp b/test/indirect_iterator_test.cpp index 4ed920536..02c291416 100644 --- a/test/indirect_iterator_test.cpp +++ b/test/indirect_iterator_test.cpp @@ -28,7 +28,7 @@ #include -#include +#include #include #include @@ -44,7 +44,7 @@ // interoperability (but may support const/mutable interop). # define NO_MUTABLE_CONST_STD_SET_ITERATOR_INTEROPERABILITY -#endif +#endif template struct see_type; @@ -53,7 +53,7 @@ template struct see_val; struct my_iterator_tag : public std::random_access_iterator_tag { }; using boost::dummyT; - + typedef std::vector storage; typedef std::vector pointer_ra_container; typedef std::set iterator_set; @@ -62,7 +62,7 @@ template struct indirect_iterator_pair_generator { typedef boost::indirect_iterator iterator; - + typedef boost::indirect_iterator< typename Container::iterator , typename iterator::value_type const @@ -73,7 +73,7 @@ void more_indirect_iterator_tests() { storage store(1000); std::generate(store.begin(), store.end(), rand); - + pointer_ra_container ptr_ra_container; iterator_set iter_set; @@ -90,27 +90,27 @@ void more_indirect_iterator_tests() BOOST_TEST(static_cast(de - db) == store.size()); BOOST_TEST(db + store.size() == de); indirect_ra_container::const_iterator dci = db; - + BOOST_TEST(dci == db); - + #ifndef NO_MUTABLE_CONST_RA_ITERATOR_INTEROPERABILITY BOOST_TEST(db == dci); #endif - + BOOST_TEST(dci != de); BOOST_TEST(dci < de); BOOST_TEST(dci <= de); - + #ifndef NO_MUTABLE_CONST_RA_ITERATOR_INTEROPERABILITY BOOST_TEST(de >= dci); BOOST_TEST(de > dci); #endif - + dci = de; BOOST_TEST(dci == de); boost::random_access_iterator_test(db + 1, store.size() - 1, boost::next(store.begin())); - + *db = 999; BOOST_TEST(store.front() == 999); @@ -125,15 +125,15 @@ void more_indirect_iterator_tests() indirect_set_iterator se(iter_set.end()); const_indirect_set_iterator sci(iter_set.begin()); BOOST_TEST(sci == sb); - + # ifndef NO_MUTABLE_CONST_STD_SET_ITERATOR_INTEROPERABILITY BOOST_TEST(se != sci); # endif - + BOOST_TEST(sci != se); sci = se; BOOST_TEST(sci == se); - + *boost::prior(se) = 888; BOOST_TEST(store.back() == 888); BOOST_TEST(std::equal(sb, se, store.begin())); @@ -145,7 +145,7 @@ void more_indirect_iterator_tests() // element_type detector; defaults to true so the test passes when // has_xxx isn't implemented BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_element_type, element_type, true) - + int main() { @@ -156,10 +156,10 @@ main() # if BOOST_WORKAROUND(BOOST_MSVC, == 1200) boost::shared_ptr zz((dummyT*)0); // Why? I don't know, but it suppresses a bad instantiation. # endif - + typedef std::vector > shared_t; shared_t shared; - + // Concept checks { typedef boost::indirect_iterator iter_t; @@ -169,7 +169,7 @@ main() std::iterator_traits::value_type >::value ); - + typedef boost::indirect_iterator< shared_t::iterator , boost::iterator_value::type const @@ -177,14 +177,14 @@ main() # ifndef NO_MUTABLE_CONST_RA_ITERATOR_INTEROPERABILITY boost::function_requires< boost_concepts::InteroperableIteratorConcept >(); -# endif +# endif } // Test indirect_iterator_generator { for (int jj = 0; jj < N; ++jj) shared.push_back(boost::shared_ptr(new dummyT(jj))); - + dummyT* ptr[N]; for (int k = 0; k < N; ++k) ptr[k] = array + k; @@ -202,16 +202,16 @@ main() , N, array); boost::random_access_iterator_test(boost::make_indirect_iterator(ptr), N, array); - + // check operator-> assert((*i).m_x == i->foo()); const_indirect_iterator j(ptr); boost::random_access_iterator_test(j, N, array); - + dummyT const*const* const_ptr = ptr; boost::random_access_iterator_test(boost::make_indirect_iterator(const_ptr), N, array); - + boost::const_nonconst_iterator_test(i, ++j); more_indirect_iterator_tests(); diff --git a/test/interoperable.cpp b/test/interoperable.cpp index ba4196a5b..ad4167262 100644 --- a/test/interoperable.cpp +++ b/test/interoperable.cpp @@ -4,16 +4,16 @@ #include #include -#include +#include #include struct mutable_it : boost::iterator_adaptor { typedef boost::iterator_adaptor super_t; - + mutable_it(); explicit mutable_it(int* p) : super_t(p) {} - + bool equal(mutable_it const& rhs) const { return this->base() == rhs.base(); @@ -23,7 +23,7 @@ struct mutable_it : boost::iterator_adaptor struct constant_it : boost::iterator_adaptor { typedef boost::iterator_adaptor super_t; - + constant_it(); explicit constant_it(int* p) : super_t(p) {} constant_it(mutable_it const& x) : super_t(x.base()) {} @@ -37,7 +37,7 @@ struct constant_it : boost::iterator_adaptor int main() { int data[] = { 49, 77 }; - + mutable_it i(data); constant_it j(data + 1); BOOST_TEST(i < j); @@ -46,7 +46,7 @@ int main() BOOST_TEST(j >= i); BOOST_TEST(j - i == 1); BOOST_TEST(i - j == -1); - + constant_it k = i; BOOST_TEST(!(i < k)); @@ -55,6 +55,6 @@ int main() BOOST_TEST(k >= i); BOOST_TEST(k - i == 0); BOOST_TEST(i - k == 0); - + return boost::report_errors(); } diff --git a/test/iterator_adaptor_test.cpp b/test/iterator_adaptor_test.cpp index 66c67b445..5b9989125 100644 --- a/test/iterator_adaptor_test.cpp +++ b/test/iterator_adaptor_test.cpp @@ -19,7 +19,7 @@ #endif #include -# include +# include #include #include diff --git a/test/iterator_traits_test.cpp b/test/iterator_traits_test.cpp index 3131d4464..1aa46d6ca 100644 --- a/test/iterator_traits_test.cpp +++ b/test/iterator_traits_test.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include // A UDT for which we can specialize std::iterator_traits on From c2929ea6c66f69867aea8924c2fa679a9b6ba19e Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 4 Mar 2020 01:02:52 +0300 Subject: [PATCH 023/173] Updated to use boost/bind/bind.hpp to avoid warnings and compliance with C++20. boost/bind.hpp emits warnings about deprecating global placeholder argument keywords. C++20 removes std::bind1st/bind2nd, so replaced their usage with boost::bind. --- doc/quickbook/filter_iterator.qbk | 4 ++-- doc/quickbook/indirect_iterator.qbk | 2 +- example/filter_iterator_example.cpp | 5 +++-- example/indirect_iterator_example.cpp | 3 ++- test/transform_iterator_test.cpp | 29 +++++++++++++-------------- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/doc/quickbook/filter_iterator.qbk b/doc/quickbook/filter_iterator.qbk index f21200301..e7cace828 100644 --- a/doc/quickbook/filter_iterator.qbk +++ b/doc/quickbook/filter_iterator.qbk @@ -50,11 +50,11 @@ the integers greater than `-2`. // Another example using make_filter_iterator() std::copy( boost::make_filter_iterator( - std::bind2nd(std::greater(), -2) + std::bind(std::greater(), std::placeholders::_1, -2) , numbers, numbers + N) , boost::make_filter_iterator( - std::bind2nd(std::greater(), -2) + std::bind(std::greater(), std::placeholders::_1, -2) , numbers + N, numbers + N) , std::ostream_iterator(std::cout, " ") diff --git a/doc/quickbook/indirect_iterator.qbk b/doc/quickbook/indirect_iterator.qbk index 06623f9e8..89ab38cbb 100644 --- a/doc/quickbook/indirect_iterator.qbk +++ b/doc/quickbook/indirect_iterator.qbk @@ -49,7 +49,7 @@ using the `make_indirect_iterator` helper function. const_indirect_last(pointers_to_chars + N); std::transform(const_indirect_first, const_indirect_last, - mutable_indirect_first, std::bind1st(std::plus(), 1)); + mutable_indirect_first, std::bind(std::plus(), 1, std::placeholders::_1)); std::copy(mutable_indirect_first, mutable_indirect_last, std::ostream_iterator(std::cout, ",")); diff --git a/example/filter_iterator_example.cpp b/example/filter_iterator_example.cpp index 8880c8d52..610c29b04 100644 --- a/example/filter_iterator_example.cpp +++ b/example/filter_iterator_example.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include // for exit_success struct is_positive_number { @@ -42,11 +43,11 @@ int main() // Another example using make_filter_iterator() std::copy( boost::make_filter_iterator( - std::bind2nd(std::greater(), -2) + boost::bind(std::greater(), boost::placeholders::_1, -2) , numbers, numbers + N) , boost::make_filter_iterator( - std::bind2nd(std::greater(), -2) + boost::bind(std::greater(), boost::placeholders::_1, -2) , numbers + N, numbers + N) , std::ostream_iterator(std::cout, " ") diff --git a/example/indirect_iterator_example.cpp b/example/indirect_iterator_example.cpp index abbf46c3a..478f9bc87 100644 --- a/example/indirect_iterator_example.cpp +++ b/example/indirect_iterator_example.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include int main(int, char*[]) @@ -41,7 +42,7 @@ int main(int, char*[]) const_indirect_last(pointers_to_chars + N); std::transform(const_indirect_first, const_indirect_last, - mutable_indirect_first, std::bind1st(std::plus(), 1)); + mutable_indirect_first, boost::bind(std::plus(), 1, boost::placeholders::_1)); std::copy(mutable_indirect_first, mutable_indirect_last, std::ostream_iterator(std::cout, ",")); diff --git a/test/transform_iterator_test.cpp b/test/transform_iterator_test.cpp index 3caad2aea..7a77b2c4f 100644 --- a/test/transform_iterator_test.cpp +++ b/test/transform_iterator_test.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION @@ -114,9 +113,9 @@ struct polymorphic_mult_functor template struct result {typedef void type;}; template struct result {typedef void type;}; - template + template T operator()(const T& _arg) const {return _arg*2;} - template + template void operator()(const T& _arg) { BOOST_ASSERT(0); } }; @@ -139,15 +138,15 @@ main() for (int k = 0; k < N; ++k) x[k] = k; std::copy(x, x + N, y); - + for (int k2 = 0; k2 < N; ++k2) x[k2] = x[k2] * 2; - + typedef boost::transform_iterator iter_t; iter_t i(y, adaptable_mult_functor(2)); boost::input_iterator_test(i, x[0], x[1]); boost::input_iterator_test(iter_t(&y[0], adaptable_mult_functor(2)), x[0], x[1]); - + boost::random_access_readable_iterator_test(i, N, x); } @@ -157,15 +156,15 @@ main() for (int k = 0; k < N; ++k) x[k] = k; std::copy(x, x + N, y); - + for (int k2 = 0; k2 < N; ++k2) x[k2] = x[k2] * 2; - + typedef boost::transform_iterator iter_t; iter_t i(y, mult_functor(2)); boost::input_iterator_test(i, x[0], x[1]); boost::input_iterator_test(iter_t(&y[0], mult_functor(2)), x[0], x[1]); - + boost::random_access_readable_iterator_test(i, N, x); } @@ -196,16 +195,16 @@ main() for (int k = 0; k < N; ++k) x[k] = k; std::copy(x, x + N, y); - + for (int k2 = 0; k2 < N; ++k2) x[k2] = x[k2] * 2; - + boost::input_iterator_test( boost::make_transform_iterator(y, mult_2), x[0], x[1]); boost::input_iterator_test( boost::make_transform_iterator(&y[0], mult_2), x[0], x[1]); - + boost::random_access_readable_iterator_test( boost::make_transform_iterator(y, mult_2), N, x); @@ -267,16 +266,16 @@ main() for (int k = 0; k < N; ++k) x[k] = k; std::copy(x, x + N, y); - + for (int k2 = 0; k2 < N; ++k2) x[k2] = x[k2] * 2; - + boost::input_iterator_test( boost::make_transform_iterator(y, polymorphic_mult_functor()), x[0], x[1]); boost::input_iterator_test( boost::make_transform_iterator(&y[0], polymorphic_mult_functor()), x[0], x[1]); - + boost::random_access_readable_iterator_test( boost::make_transform_iterator(y, polymorphic_mult_functor()), N, x); } From 80ec58bb3b4a46fb8283eaaf7807f1503a0e83c6 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 4 Mar 2020 01:06:45 +0300 Subject: [PATCH 024/173] Trim trailing spaces. --- example/counting_iterator_example.cpp | 4 +-- example/filter_iterator_example.cpp | 14 ++++---- example/func_output_iter_example.cpp | 6 ++-- example/indirect_iterator_example.cpp | 10 +++--- example/node_iterator1.cpp | 6 ++-- example/node_iterator2.cpp | 10 +++--- example/node_iterator3.cpp | 10 +++--- example/permutation_iter_example.cpp | 2 +- example/reverse_iterator_example.cpp | 4 +-- example/shared_iterator_example1.cpp | 6 ++-- example/shared_iterator_example2.cpp | 4 +-- example/shared_iterator_example3.cpp | 6 ++-- example/transform_iterator_example.cpp | 6 ++-- test/concept_tests.cpp | 2 +- test/counting_iterator_test.cpp | 20 +++++------ test/filter_iterator_test.cpp | 22 ++++++------ test/function_input_iterator_test.cpp | 2 +- test/indirect_iter_member_types.cpp | 24 ++++++------- test/indirect_iterator_test.cpp | 2 +- test/is_lvalue_iterator.cpp | 20 +++++------ test/is_readable_iterator.cpp | 14 ++++---- test/iterator_adaptor_cc.cpp | 2 +- test/iterator_adaptor_test.cpp | 48 +++++++++++++------------- test/iterator_archetype_cc.cpp | 8 ++--- test/iterator_traits_test.cpp | 10 +++--- test/permutation_iterator_test.cpp | 12 +++---- test/pointee.cpp | 14 ++++---- test/reverse_iterator_test.cpp | 22 ++++++------ test/shared_iterator_test.cpp | 14 ++++---- test/transform_iterator_test.cpp | 4 +-- 30 files changed, 164 insertions(+), 164 deletions(-) diff --git a/example/counting_iterator_example.cpp b/example/counting_iterator_example.cpp index c7d8add91..de4548724 100644 --- a/example/counting_iterator_example.cpp +++ b/example/counting_iterator_example.cpp @@ -41,12 +41,12 @@ int main(int, char*[]) // Use indirect iterator to print out numbers by accessing // them through the array of pointers. - std::cout << "indirectly printing out the numbers from 0 to " + std::cout << "indirectly printing out the numbers from 0 to " << N << std::endl; std::copy(boost::make_indirect_iterator(pointers.begin()), boost::make_indirect_iterator(pointers.end()), std::ostream_iterator(std::cout, " ")); std::cout << std::endl; - + return boost::exit_success; } diff --git a/example/filter_iterator_example.cpp b/example/filter_iterator_example.cpp index 610c29b04..b427dea4b 100644 --- a/example/filter_iterator_example.cpp +++ b/example/filter_iterator_example.cpp @@ -19,10 +19,10 @@ int main() { int numbers_[] = { 0, -1, 4, -3, 5, 8, -2 }; const int N = sizeof(numbers_)/sizeof(int); - + typedef int* base_iterator; base_iterator numbers(numbers_); - + // Example using make_filter_iterator() std::copy(boost::make_filter_iterator(numbers, numbers + N), boost::make_filter_iterator(numbers + N, numbers + N), @@ -32,7 +32,7 @@ int main() // Example using filter_iterator typedef boost::filter_iterator FilterIter; - + is_positive_number predicate; FilterIter filter_iter_first(predicate, numbers, numbers + N); FilterIter filter_iter_last(predicate, numbers + N, numbers + N); @@ -45,15 +45,15 @@ int main() boost::make_filter_iterator( boost::bind(std::greater(), boost::placeholders::_1, -2) , numbers, numbers + N) - + , boost::make_filter_iterator( boost::bind(std::greater(), boost::placeholders::_1, -2) , numbers + N, numbers + N) - + , std::ostream_iterator(std::cout, " ") ); - + std::cout << std::endl; - + return boost::exit_success; } diff --git a/example/func_output_iter_example.cpp b/example/func_output_iter_example.cpp index 9c0631988..8a76b7f2c 100644 --- a/example/func_output_iter_example.cpp +++ b/example/func_output_iter_example.cpp @@ -19,7 +19,7 @@ struct string_appender string_appender(std::string& s) : m_str(&s) {} - + void operator()(const std::string& x) const { *m_str += x; @@ -37,9 +37,9 @@ int main(int, char*[]) x.push_back("!"); std::string s = ""; - std::copy(x.begin(), x.end(), + std::copy(x.begin(), x.end(), boost::make_function_output_iterator(string_appender(s))); - + std::cout << s << std::endl; return 0; diff --git a/example/indirect_iterator_example.cpp b/example/indirect_iterator_example.cpp index 478f9bc87..74de3178e 100644 --- a/example/indirect_iterator_example.cpp +++ b/example/indirect_iterator_example.cpp @@ -21,13 +21,13 @@ int main(int, char*[]) pointers_to_chars[i] = &characters[i]; // Example of using indirect_iterator - + boost::indirect_iterator indirect_first(pointers_to_chars), indirect_last(pointers_to_chars + N); std::copy(indirect_first, indirect_last, std::ostream_iterator(std::cout, ",")); std::cout << std::endl; - + // Example of making mutable and constant indirect iterators @@ -48,13 +48,13 @@ int main(int, char*[]) std::ostream_iterator(std::cout, ",")); std::cout << std::endl; - + // Example of using make_indirect_iterator() - std::copy(boost::make_indirect_iterator(pointers_to_chars), + std::copy(boost::make_indirect_iterator(pointers_to_chars), boost::make_indirect_iterator(pointers_to_chars + N), std::ostream_iterator(std::cout, ",")); std::cout << std::endl; - + return 0; } diff --git a/example/node_iterator1.cpp b/example/node_iterator1.cpp index 94b34e8ca..722a28fd5 100644 --- a/example/node_iterator1.cpp +++ b/example/node_iterator1.cpp @@ -15,11 +15,11 @@ int main() #if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr > nodes(new node(42)); - + #else std::unique_ptr > nodes(new node(42)); - + #endif nodes->append(new node(" is greater than ")); @@ -30,7 +30,7 @@ int main() , std::ostream_iterator(std::cout, " ") ); std::cout << std::endl; - + std::for_each( node_iterator(nodes.get()), node_iterator() , std::mem_fun_ref(&node_base::double_me) diff --git a/example/node_iterator2.cpp b/example/node_iterator2.cpp index f8f873ec3..5ab71b67c 100644 --- a/example/node_iterator2.cpp +++ b/example/node_iterator2.cpp @@ -16,11 +16,11 @@ int main() #if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr > nodes(new node(42)); - + #else std::unique_ptr > nodes(new node(42)); - + #endif nodes->append(new node(" is greater than ")); @@ -29,16 +29,16 @@ int main() // Check interoperability assert(node_iterator(nodes.get()) == node_const_iterator(nodes.get())); assert(node_const_iterator(nodes.get()) == node_iterator(nodes.get())); - + assert(node_iterator(nodes.get()) != node_const_iterator()); assert(node_const_iterator(nodes.get()) != node_iterator()); - + std::copy( node_iterator(nodes.get()), node_iterator() , std::ostream_iterator(std::cout, " ") ); std::cout << std::endl; - + std::for_each( node_iterator(nodes.get()), node_iterator() , boost::mem_fn(&node_base::double_me) diff --git a/example/node_iterator3.cpp b/example/node_iterator3.cpp index 7cb42382b..551f21872 100644 --- a/example/node_iterator3.cpp +++ b/example/node_iterator3.cpp @@ -16,11 +16,11 @@ int main() #if defined(BOOST_NO_CXX11_SMART_PTR) std::auto_ptr > nodes(new node(42)); - + #else std::unique_ptr > nodes(new node(42)); - + #endif nodes->append(new node(" is greater than ")); @@ -29,16 +29,16 @@ int main() // Check interoperability assert(node_iterator(nodes.get()) == node_const_iterator(nodes.get())); assert(node_const_iterator(nodes.get()) == node_iterator(nodes.get())); - + assert(node_iterator(nodes.get()) != node_const_iterator()); assert(node_const_iterator(nodes.get()) != node_iterator()); - + std::copy( node_iterator(nodes.get()), node_iterator() , std::ostream_iterator(std::cout, " ") ); std::cout << std::endl; - + std::for_each( node_iterator(nodes.get()), node_iterator() , boost::mem_fn(&node_base::double_me) diff --git a/example/permutation_iter_example.cpp b/example/permutation_iter_example.cpp index aad6125de..5089d6438 100644 --- a/example/permutation_iter_example.cpp +++ b/example/permutation_iter_example.cpp @@ -27,7 +27,7 @@ int main() { *el_it = std::distance(elements.begin(), el_it); index_type indices( index_size ); - for(index_type::iterator i_it = indices.begin() ; i_it != indices.end() ; ++i_it ) + for(index_type::iterator i_it = indices.begin() ; i_it != indices.end() ; ++i_it ) *i_it = element_range_size - index_size + std::distance(indices.begin(), i_it); std::reverse( indices.begin(), indices.end() ); diff --git a/example/reverse_iterator_example.cpp b/example/reverse_iterator_example.cpp index 61b8c4fd0..0baa0ff0d 100644 --- a/example/reverse_iterator_example.cpp +++ b/example/reverse_iterator_example.cpp @@ -15,13 +15,13 @@ int main(int, char*[]) const int N = sizeof(letters_)/sizeof(char) - 1; typedef char* base_iterator; base_iterator letters(letters_); - + std::cout << "original sequence of letters:\t\t\t" << letters_ << std::endl; // Use reverse_iterator to print a sequence of letters in reverse // order. - + boost::reverse_iterator reverse_letters_first(letters + N), reverse_letters_last(letters); diff --git a/example/shared_iterator_example1.cpp b/example/shared_iterator_example1.cpp index f88e0944f..0ca611992 100644 --- a/example/shared_iterator_example1.cpp +++ b/example/shared_iterator_example1.cpp @@ -1,6 +1,6 @@ // Copyright 2003 The Trustees of Indiana University. -// Use, modification and distribution is subject to the Boost Software +// Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -16,14 +16,14 @@ typedef boost::shared_container_iterator< std::vector > iterator; void set_range(iterator& i, iterator& end) { boost::shared_ptr< std::vector > ints(new std::vector()); - + ints->push_back(0); ints->push_back(1); ints->push_back(2); ints->push_back(3); ints->push_back(4); ints->push_back(5); - + i = iterator(ints->begin(),ints); end = iterator(ints->end(),ints); } diff --git a/example/shared_iterator_example2.cpp b/example/shared_iterator_example2.cpp index a9577078c..e8b0dc6ec 100644 --- a/example/shared_iterator_example2.cpp +++ b/example/shared_iterator_example2.cpp @@ -1,6 +1,6 @@ // Copyright 2003 The Trustees of Indiana University. -// Use, modification and distribution is subject to the Boost Software +// Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -36,7 +36,7 @@ int main() { print_range_nl(boost::make_shared_container_iterator(ints->begin(),ints), boost::make_shared_container_iterator(ints->end(),ints)); } - + return 0; diff --git a/example/shared_iterator_example3.cpp b/example/shared_iterator_example3.cpp index 5615d4547..971b01f86 100644 --- a/example/shared_iterator_example3.cpp +++ b/example/shared_iterator_example3.cpp @@ -1,6 +1,6 @@ // Copyright 2003 The Trustees of Indiana University. -// Use, modification and distribution is subject to the Boost Software +// Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -8,7 +8,7 @@ #include "boost/shared_ptr.hpp" #include "boost/tuple/tuple.hpp" // for boost::tie #include // for std::copy -#include +#include #include @@ -31,7 +31,7 @@ int main() { iterator i,end; - + boost::tie(i,end) = return_range(); std::copy(i,end,std::ostream_iterator(std::cout,",")); diff --git a/example/transform_iterator_example.cpp b/example/transform_iterator_example.cpp index ce1b413b8..a684ebf25 100644 --- a/example/transform_iterator_example.cpp +++ b/example/transform_iterator_example.cpp @@ -1,4 +1,4 @@ -// (C) Copyright Jeremy Siek 2000-2004. +// (C) Copyright Jeremy Siek 2000-2004. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -15,7 +15,7 @@ namespace boost { - template + template class binder1st { public: typedef typename Operation::result_type result_type; @@ -70,6 +70,6 @@ main(int, char*[]) boost::make_transform_iterator(x + N, boost::bind1st(std::plus(), 4)), std::ostream_iterator(std::cout, " ")); std::cout << std::endl; - + return 0; } diff --git a/test/concept_tests.cpp b/test/concept_tests.cpp index 5fb6a78b4..091f6e52b 100644 --- a/test/concept_tests.cpp +++ b/test/concept_tests.cpp @@ -71,7 +71,7 @@ main() boost::iterator_traversal::type tc; boost::random_access_traversal_tag derived = tc; (void)derived; - + boost::function_requires< boost_concepts::WritableIteratorConcept >(); boost::function_requires< diff --git a/test/counting_iterator_test.cpp b/test/counting_iterator_test.cpp index 59caa0dc2..899b0455c 100644 --- a/test/counting_iterator_test.cpp +++ b/test/counting_iterator_test.cpp @@ -42,7 +42,7 @@ #include #ifndef __BORLANDC__ # include -#endif +#endif #include #include #include @@ -94,13 +94,13 @@ void category_test( // Pick a random position internal to the range difference_type offset = (unsigned)rand() % distance; - + #ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_TEST(offset >= 0); -#else +#else assert_nonnegative::test(offset); #endif - + CountingIterator internal = start; std::advance(internal, offset); @@ -111,7 +111,7 @@ void category_test( std::pair xy( std::equal_range(start, finish, *internal)); CountingIterator x = xy.first, y = xy.second; - + BOOST_TEST(boost::detail::distance(x, y) == 1); // Show that values outside the range can't be found @@ -122,7 +122,7 @@ void category_test( std::vector v; for (value_type z = *start; !(z == *finish); ++z) v.push_back(z); - + // Note that this test requires a that the first argument is // dereferenceable /and/ a valid iterator prior to the first argument boost::random_access_iterator_test(start, v.size(), v.begin()); @@ -200,11 +200,11 @@ void test_container(Container* = 0) // default arg works around MSVC bug Container c(1 + (unsigned)rand() % 1673); const typename Container::iterator start = c.begin(); - + // back off by 1 to leave room for dereferenceable value at the end typename Container::iterator finish = start; std::advance(finish, c.size() - 1); - + test(start, finish); typedef typename Container::const_iterator const_iterator; @@ -283,14 +283,14 @@ int main() test_integer3(); test_integer(); test_integer(); - + // Some tests on container iterators, to prove we handle a few different categories test_container >(); test_container >(); # ifndef BOOST_NO_SLIST test_container >(); # endif - + // Also prove that we can handle raw pointers. int array[2000]; test(boost::make_counting_iterator(array), boost::make_counting_iterator(array+2000-1)); diff --git a/test/filter_iterator_test.cpp b/test/filter_iterator_test.cpp index beaab4dd4..cf850bcf7 100644 --- a/test/filter_iterator_test.cpp +++ b/test/filter_iterator_test.cpp @@ -1,4 +1,4 @@ -// Copyright David Abrahams 2003, Jeremy Siek 2004. +// Copyright David Abrahams 2003, Jeremy Siek 2004. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -18,7 +18,7 @@ #include using boost::dummyT; - + struct one_or_four { bool operator()(dummyT x) const @@ -116,7 +116,7 @@ int main() boost::function_requires< boost_concepts::WritableIteratorConcept >(); boost::function_requires< boost_concepts::SinglePassIteratorConcept >(); } -#endif +#endif { typedef boost::iterator_archetype< const dummyT @@ -128,7 +128,7 @@ int main() boost::function_requires< boost_concepts::ReadableIteratorConcept >(); boost::function_requires< boost_concepts::ForwardTraversalConcept >(); } - + #if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) // Causes Internal Error in linker. { typedef boost::iterator_archetype< @@ -165,7 +165,7 @@ int main() boost::function_requires< boost_concepts::LvalueIteratorConcept >(); boost::function_requires< boost_concepts::ForwardTraversalConcept >(); } -#endif +#endif { typedef boost::iterator_archetype< @@ -178,7 +178,7 @@ int main() boost::function_requires< boost_concepts::ReadableIteratorConcept >(); boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); } - + #if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) // Causes Internal Error in linker. { typedef boost::iterator_archetype< @@ -215,11 +215,11 @@ int main() boost::function_requires< boost_concepts::LvalueIteratorConcept >(); boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); } -#endif +#endif // Run-time tests - dummyT array[] = { dummyT(0), dummyT(1), dummyT(2), + dummyT array[] = { dummyT(0), dummyT(1), dummyT(2), dummyT(3), dummyT(4), dummyT(5) }; const int N = sizeof(array)/sizeof(dummyT); @@ -235,9 +235,9 @@ int main() , boost::random_access_traversal_tag >::value )); - + //# endif - + // On compilers not supporting partial specialization, we can do more type // deduction with deque iterators than with pointers... unless the library // is broken ;-( @@ -258,7 +258,7 @@ int main() , boost::make_reverse_iterator(array2.begin()) ), dummyT(4), dummyT(1)); - + boost::bidirectional_readable_iterator_test( filter_iter(array+0, array+N), dummyT(1), dummyT(4)); diff --git a/test/function_input_iterator_test.cpp b/test/function_input_iterator_test.cpp index a4221ee58..4843f0152 100644 --- a/test/function_input_iterator_test.cpp +++ b/test/function_input_iterator_test.cpp @@ -55,7 +55,7 @@ int main() ones ones_generator; vector values(10); generate(values.begin(), values.end(), ones()); - + vector generated; copy( boost::make_function_input_iterator(ones_generator, 0), diff --git a/test/indirect_iter_member_types.cpp b/test/indirect_iter_member_types.cpp index da09ac8be..240e664fb 100644 --- a/test/indirect_iter_member_types.cpp +++ b/test/indirect_iter_member_types.cpp @@ -30,16 +30,16 @@ struct my_ptr { // Borland 5.6.4 and earlier drop const all over the place, so this // test will fail in the lines marked with (**) - + int main() { { typedef boost::indirect_iterator Iter; STATIC_ASSERT_SAME(Iter::value_type, int); - STATIC_ASSERT_SAME(Iter::reference, int&); - STATIC_ASSERT_SAME(Iter::pointer, int*); + STATIC_ASSERT_SAME(Iter::reference, int&); + STATIC_ASSERT_SAME(Iter::pointer, int*); STATIC_ASSERT_SAME(Iter::difference_type, std::ptrdiff_t); - + BOOST_STATIC_ASSERT((boost::is_convertible::value)); BOOST_STATIC_ASSERT((boost::is_convertible::type, @@ -54,13 +54,13 @@ int main() { typedef boost::indirect_iterator Iter; STATIC_ASSERT_SAME(Iter::value_type, int); - STATIC_ASSERT_SAME(Iter::reference, int&); - STATIC_ASSERT_SAME(Iter::pointer, int*); + STATIC_ASSERT_SAME(Iter::reference, int&); + STATIC_ASSERT_SAME(Iter::pointer, int*); } { typedef boost::indirect_iterator Iter; STATIC_ASSERT_SAME(Iter::value_type, int); - STATIC_ASSERT_SAME(Iter::reference, const int&); + STATIC_ASSERT_SAME(Iter::reference, const int&); STATIC_ASSERT_SAME(Iter::pointer, const int*); // (**) } { @@ -68,9 +68,9 @@ int main() STATIC_ASSERT_SAME(Iter::value_type, zow); STATIC_ASSERT_SAME(Iter::reference, const zow&); // (**) STATIC_ASSERT_SAME(Iter::pointer, const zow*); // (**) - + STATIC_ASSERT_SAME(Iter::difference_type, std::ptrdiff_t); - + BOOST_STATIC_ASSERT((boost::is_convertible::value)); BOOST_STATIC_ASSERT((boost::is_convertible::type, @@ -79,9 +79,9 @@ int main() { typedef boost::indirect_iterator Iter; STATIC_ASSERT_SAME(Iter::value_type, int); - STATIC_ASSERT_SAME(Iter::reference, long&); - STATIC_ASSERT_SAME(Iter::pointer, int*); - STATIC_ASSERT_SAME(Iter::difference_type, short); + STATIC_ASSERT_SAME(Iter::reference, long&); + STATIC_ASSERT_SAME(Iter::pointer, int*); + STATIC_ASSERT_SAME(Iter::difference_type, short); } return 0; } diff --git a/test/indirect_iterator_test.cpp b/test/indirect_iterator_test.cpp index 02c291416..a08afa8b2 100644 --- a/test/indirect_iterator_test.cpp +++ b/test/indirect_iterator_test.cpp @@ -149,7 +149,7 @@ BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_element_type, element_type, true) int main() { - dummyT array[] = { dummyT(0), dummyT(1), dummyT(2), + dummyT array[] = { dummyT(0), dummyT(1), dummyT(2), dummyT(3), dummyT(4), dummyT(5) }; const int N = sizeof(array)/sizeof(dummyT); diff --git a/test/is_lvalue_iterator.cpp b/test/is_lvalue_iterator.cpp index 38710323e..ba880d70b 100644 --- a/test/is_lvalue_iterator.cpp +++ b/test/is_lvalue_iterator.cpp @@ -38,7 +38,7 @@ struct noncopyable_iterator typedef std::ptrdiff_t difference_type; typedef boost::noncopyable* pointer; typedef boost::noncopyable& reference; - + boost::noncopyable const& operator*() const; }; @@ -50,13 +50,13 @@ struct proxy_iterator typedef std::ptrdiff_t difference_type; typedef T* pointer; typedef T& reference; - + struct proxy { operator value_type&() const; proxy& operator=(value_type) const; }; - + proxy operator*() const; }; @@ -111,14 +111,14 @@ int main() BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); - + BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); BOOST_STATIC_ASSERT(boost::is_lvalue_iterator >::value); - - + + BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator::value); BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator::value); BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator::iterator>::value); @@ -131,18 +131,18 @@ int main() BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator::value); #endif BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator::value); - + BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); -#endif +#endif BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); - + BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator >::value); BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator >::value); BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator >::value); BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator >::value); - + return 0; } diff --git a/test/is_readable_iterator.cpp b/test/is_readable_iterator.cpp index c6636977e..1d33a64ab 100644 --- a/test/is_readable_iterator.cpp +++ b/test/is_readable_iterator.cpp @@ -38,7 +38,7 @@ struct noncopyable_iterator typedef std::ptrdiff_t difference_type; typedef boost::noncopyable* pointer; typedef boost::noncopyable& reference; - + boost::noncopyable const& operator*() const; }; @@ -49,13 +49,13 @@ struct proxy_iterator typedef std::ptrdiff_t difference_type; typedef v* pointer; typedef v& reference; - + struct proxy { operator v&(); proxy& operator=(v) const; }; - + proxy operator*() const; }; @@ -66,12 +66,12 @@ struct proxy_iterator2 typedef std::ptrdiff_t difference_type; typedef v* pointer; typedef v& reference; - + struct proxy { proxy& operator=(v) const; }; - + proxy operator*() const; }; @@ -87,10 +87,10 @@ int main() BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); BOOST_STATIC_ASSERT(!boost::is_readable_iterator::value); BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); - + // Make sure inaccessible copy constructor doesn't prevent // readability BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); - + return 0; } diff --git a/test/iterator_adaptor_cc.cpp b/test/iterator_adaptor_cc.cpp index 599474c1f..1ab676a29 100644 --- a/test/iterator_adaptor_cc.cpp +++ b/test/iterator_adaptor_cc.cpp @@ -41,6 +41,6 @@ int main() boost::function_requires< boost_concepts::InteroperableIteratorConcept >(); } #endif - + return boost::exit_success; } diff --git a/test/iterator_adaptor_test.cpp b/test/iterator_adaptor_test.cpp index 5b9989125..88a8a1bef 100644 --- a/test/iterator_adaptor_test.cpp +++ b/test/iterator_adaptor_test.cpp @@ -16,7 +16,7 @@ #if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) # include # include -#endif +#endif #include # include @@ -58,7 +58,7 @@ struct ptr_iterator , boost::random_access_traversal_tag #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) , V& -#endif +#endif > { private: @@ -69,9 +69,9 @@ struct ptr_iterator , boost::random_access_traversal_tag #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) , V& -#endif +#endif > super_t; - + public: ptr_iterator() { } ptr_iterator(V* d) : super_t(d) { } @@ -95,7 +95,7 @@ struct modify_traversal , Traversal > {}; - + template struct fwd_iterator : boost::iterator_adaptor< @@ -108,7 +108,7 @@ struct fwd_iterator fwd_iterator , boost::forward_iterator_archetype > super_t; - + public: fwd_iterator() { } fwd_iterator(boost::forward_iterator_archetype d) : super_t(d) { } @@ -126,7 +126,7 @@ struct in_iterator in_iterator , boost::input_iterator_archetype_no_proxy > super_t; - + public: in_iterator() { } in_iterator(boost::input_iterator_archetype_no_proxy d) : super_t(d) { } @@ -145,7 +145,7 @@ struct constant_iterator , Iter , typename std::iterator_traits::value_type const > base_t; - + constant_iterator() {} constant_iterator(Iter it) : base_t(it) {} @@ -181,7 +181,7 @@ int static_assert_traversal(Iter* = 0, Trav* = 0) int main() { - dummyT array[] = { dummyT(0), dummyT(1), dummyT(2), + dummyT array[] = { dummyT(0), dummyT(1), dummyT(2), dummyT(3), dummyT(4), dummyT(5) }; const int N = sizeof(array)/sizeof(dummyT); @@ -192,7 +192,7 @@ main() { ptr_iterator i(array); boost::random_access_iterator_test(i, N, array); - + ptr_iterator j(array); boost::random_access_iterator_test(j, N, array); boost::const_nonconst_iterator_test(i, ++j); @@ -210,25 +210,25 @@ main() test = static_assert_same::value; #if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) BOOST_STATIC_ASSERT((boost::is_convertible::value)); -#endif +#endif } - - { + + { // Test computation of default when the Value is const typedef ptr_iterator Iter1; test = static_assert_same::value; test = static_assert_same::value; - + #if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) BOOST_STATIC_ASSERT(boost::is_readable_iterator::value); # ifndef BOOST_NO_LVALUE_RETURN_DETECTION BOOST_STATIC_ASSERT(boost::is_lvalue_iterator::value); -# endif +# endif #endif #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) // borland drops constness test = static_assert_same::value; -#endif +#endif } { @@ -240,24 +240,24 @@ main() test = static_assert_same::value; #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) // borland drops constness test = static_assert_same::value; -#endif +#endif #ifndef BOOST_NO_LVALUE_RETURN_DETECTION BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator::value); BOOST_STATIC_ASSERT(boost::is_lvalue_iterator::value); -#endif - +#endif + typedef modify_traversal IncrementableIter; static_assert_traversal(); static_assert_traversal(); } - + // Test the iterator_adaptor { ptr_iterator i(array); boost::random_access_iterator_test(i, N, array); - + ptr_iterator j(array); boost::random_access_iterator_test(j, N, array); boost::const_nonconst_iterator_test(i, ++j); @@ -272,9 +272,9 @@ main() adaptor_type i(forward_iter); int zero = 0; if (zero) // don't do this, just make sure it compiles - BOOST_TEST((*i).m_x == i->foo()); + BOOST_TEST((*i).m_x == i->foo()); } - + // check operator-> with an input iterator { boost::input_iterator_archetype_no_proxy input_iter; @@ -282,7 +282,7 @@ main() adaptor_type i(input_iter); int zero = 0; if (zero) // don't do this, just make sure it compiles - BOOST_TEST((*i).m_x == i->foo()); + BOOST_TEST((*i).m_x == i->foo()); } // check that base_type is correct diff --git a/test/iterator_archetype_cc.cpp b/test/iterator_archetype_cc.cpp index 580a32ccf..98d32ae7d 100644 --- a/test/iterator_archetype_cc.cpp +++ b/test/iterator_archetype_cc.cpp @@ -21,7 +21,7 @@ int main() boost::function_requires< boost_concepts::ReadableIteratorConcept >(); boost::function_requires< boost_concepts::RandomAccessTraversalConcept >(); - } + } { typedef boost::iterator_archetype< int @@ -32,7 +32,7 @@ int main() boost::function_requires< boost_concepts::ReadableIteratorConcept >(); boost::function_requires< boost_concepts::WritableIteratorConcept >(); boost::function_requires< boost_concepts::RandomAccessTraversalConcept >(); - } + } { typedef boost::iterator_archetype< const int // I don't like adding const to Value. It is redundant. -JGS @@ -43,7 +43,7 @@ int main() boost::function_requires< boost_concepts::ReadableIteratorConcept >(); boost::function_requires< boost_concepts::LvalueIteratorConcept >(); boost::function_requires< boost_concepts::RandomAccessTraversalConcept >(); - } + } { typedef boost::iterator_archetype< int @@ -54,7 +54,7 @@ int main() boost::function_requires< boost_concepts::WritableIteratorConcept >(); boost::function_requires< boost_concepts::LvalueIteratorConcept >(); boost::function_requires< boost_concepts::RandomAccessTraversalConcept >(); - } + } return boost::exit_success; } diff --git a/test/iterator_traits_test.cpp b/test/iterator_traits_test.cpp index 1aa46d6ca..4dd4e7af7 100644 --- a/test/iterator_traits_test.cpp +++ b/test/iterator_traits_test.cpp @@ -40,7 +40,7 @@ struct my_iterator1 : boost::forward_iterator_helper { my_iterator1(const char* p) : m_p(p) {} - + bool operator==(const my_iterator1& rhs) const { return this->m_p == rhs.m_p; } @@ -63,9 +63,9 @@ struct my_iterator2 typedef const char* pointer; typedef const char& reference; typedef std::forward_iterator_tag iterator_category; - + my_iterator2(const char* p) : m_p(p) {} - + bool operator==(const my_iterator2& rhs) const { return this->m_p == rhs.m_p; } @@ -189,7 +189,7 @@ maybe_pointer_test my_iterator1_test; - + non_pointer_test my_iterator2_test; @@ -205,7 +205,7 @@ int main() { std::list l(length); BOOST_TEST(boost::detail::distance(l.begin(), l.end()) == length); - + std::vector v(length); BOOST_TEST(boost::detail::distance(v.begin(), v.end()) == length); diff --git a/test/permutation_iterator_test.cpp b/test/permutation_iterator_test.cpp index 6d1421871..6fbeaadd0 100644 --- a/test/permutation_iterator_test.cpp +++ b/test/permutation_iterator_test.cpp @@ -27,7 +27,7 @@ void iterop_test() { typedef boost::permutation_iterator< double*, int const* > permutation_type; typedef boost::permutation_iterator< double const*, int const* > permutation_const_type; - + BOOST_CONCEPT_ASSERT(( boost_concepts::InteroperableIteratorConcept< permutation_type @@ -58,7 +58,7 @@ void permutation_test() permutation_type begin = boost::make_permutation_iterator( elements.begin(), indices.begin() ); permutation_type it = begin; permutation_type end = boost::make_permutation_iterator( elements.begin(), indices.end() ); - + BOOST_CHECK( it == begin ); BOOST_CHECK( it != end ); @@ -70,7 +70,7 @@ void permutation_test() } it = begin; - for( int i1 = 0; i1 < index_size - 1 ; ++++i1, ++++it ) + for( int i1 = 0; i1 < index_size - 1 ; ++++i1, ++++it ) { index_type::iterator i_it2 = indices.begin(); std::advance( i_it2, i1 ); @@ -79,14 +79,14 @@ void permutation_test() it = begin; std::advance(it, index_size); - for( index_type::iterator i_it3 = indices.end(); it != begin; ) + for( index_type::iterator i_it3 = indices.end(); it != begin; ) { BOOST_CHECK( *--it == elements[ *--i_it3 ] ); } - + it = begin; std::advance(it, index_size); - for( int i2 = 0; i2 < index_size - 1; i2+=2, --it ) + for( int i2 = 0; i2 < index_size - 1; i2+=2, --it ) { index_type::iterator i_it4 = --indices.end(); std::advance( i_it4, -i2 ); diff --git a/test/pointee.cpp b/test/pointee.cpp index 3b999472b..32e34962f 100644 --- a/test/pointee.cpp +++ b/test/pointee.cpp @@ -35,7 +35,7 @@ struct X { template operator T&() const; }; - + int main() { STATIC_ASSERT_SAME(boost::pointee >::type, int); @@ -43,16 +43,16 @@ int main() STATIC_ASSERT_SAME(boost::pointee >::type, int const); STATIC_ASSERT_SAME(boost::pointee >::type, X const); - + STATIC_ASSERT_SAME(boost::pointee >::type, int const); STATIC_ASSERT_SAME(boost::pointee >::type, X const); - + STATIC_ASSERT_SAME(boost::pointee >::type, int const); STATIC_ASSERT_SAME(boost::pointee >::type, X const); STATIC_ASSERT_SAME(boost::pointee::type, int); STATIC_ASSERT_SAME(boost::pointee::type, int const); - + STATIC_ASSERT_SAME(boost::pointee::type, X); STATIC_ASSERT_SAME(boost::pointee::type, X const); @@ -60,7 +60,7 @@ int main() STATIC_ASSERT_SAME(boost::pointee >::type, int); STATIC_ASSERT_SAME(boost::pointee >::type, X); - + STATIC_ASSERT_SAME(boost::pointee >::type, int const); STATIC_ASSERT_SAME(boost::pointee >::type, X const); @@ -68,7 +68,7 @@ int main() STATIC_ASSERT_SAME(boost::pointee >::type, int); STATIC_ASSERT_SAME(boost::pointee >::type, X); - + STATIC_ASSERT_SAME(boost::pointee >::type, int const); STATIC_ASSERT_SAME(boost::pointee >::type, X const); @@ -76,7 +76,7 @@ int main() STATIC_ASSERT_SAME(boost::pointee::iterator >::type, int); STATIC_ASSERT_SAME(boost::pointee::iterator >::type, X); - + STATIC_ASSERT_SAME(boost::pointee::const_iterator >::type, int const); STATIC_ASSERT_SAME(boost::pointee::const_iterator >::type, X const); return 0; diff --git a/test/reverse_iterator_test.cpp b/test/reverse_iterator_test.cpp index 828bdfe01..8ac5e10ef 100644 --- a/test/reverse_iterator_test.cpp +++ b/test/reverse_iterator_test.cpp @@ -20,7 +20,7 @@ using boost::dummyT; // Test reverse iterator int main() { - dummyT array[] = { dummyT(0), dummyT(1), dummyT(2), + dummyT array[] = { dummyT(0), dummyT(1), dummyT(2), dummyT(3), dummyT(4), dummyT(5) }; const int N = sizeof(array)/sizeof(dummyT); @@ -104,29 +104,29 @@ int main() boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); } #endif - + // Test reverse_iterator { dummyT reversed[N]; std::copy(array, array + N, reversed); std::reverse(reversed, reversed + N); - + typedef boost::reverse_iterator reverse_iterator; - + reverse_iterator i(reversed + N); boost::random_access_iterator_test(i, N, array); boost::random_access_iterator_test(boost::make_reverse_iterator(reversed + N), N, array); typedef boost::reverse_iterator const_reverse_iterator; - + const_reverse_iterator j(reversed + N); boost::random_access_iterator_test(j, N, array); const dummyT* const_reversed = reversed; - + boost::random_access_iterator_test(boost::make_reverse_iterator(const_reversed + N), N, array); - + boost::const_nonconst_iterator_test(i, ++j); } @@ -146,7 +146,7 @@ int main() // (e.g. "reversed + N") is used in the constructor below. const std::deque::iterator finish = reversed_container.end(); reverse_iterator i(finish); - + boost::random_access_iterator_test(i, N, array); boost::random_access_iterator_test(boost::make_reverse_iterator(reversed + N), N, array); @@ -155,7 +155,7 @@ int main() const std::deque::const_iterator const_reversed = reversed; boost::random_access_iterator_test(boost::make_reverse_iterator(const_reversed + N), N, array); - + // Many compilers' builtin deque iterators don't interoperate well, though // STLport fixes that problem. #if defined(__SGI_STL_PORT) \ @@ -164,9 +164,9 @@ int main() && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) \ && !BOOST_WORKAROUND(__LIBCOMO_VERSION__, BOOST_TESTED_AT(29)) \ && !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 1) - + boost::const_nonconst_iterator_test(i, ++j); - + #endif } diff --git a/test/shared_iterator_test.cpp b/test/shared_iterator_test.cpp index 27e007a90..a943d3049 100644 --- a/test/shared_iterator_test.cpp +++ b/test/shared_iterator_test.cpp @@ -1,13 +1,13 @@ // Copyright 2003 The Trustees of Indiana University. -// Use, modification and distribution is subject to the Boost Software +// Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// Shared container iterator adaptor +// Shared container iterator adaptor // Author: Ronald Garcia -// See http://boost.org/libs/utility/shared_container_iterator.html -// for documentation. +// See http://boost.org/libs/utility/shared_container_iterator.html +// for documentation. // // shared_iterator_test.cpp - Regression tests for shared_container_iterator. @@ -38,7 +38,7 @@ void set_range(iterator& i, iterator& end) { for (int j = 0; j != 6; ++j) objs->push_back(resource()); - + i = iterator(objs->begin(),objs); end = iterator(objs->end(),objs); BOOST_TEST_EQ(resource::count, 6); @@ -48,7 +48,7 @@ void set_range(iterator& i, iterator& end) { int main() { BOOST_TEST_EQ(resource::count, 0); - + { iterator i; { @@ -59,6 +59,6 @@ int main() { BOOST_TEST_EQ(resource::count, 6); } BOOST_TEST_EQ(resource::count, 0); - + return boost::report_errors(); } diff --git a/test/transform_iterator_test.cpp b/test/transform_iterator_test.cpp index 7a77b2c4f..b22cb161f 100644 --- a/test/transform_iterator_test.cpp +++ b/test/transform_iterator_test.cpp @@ -42,7 +42,7 @@ struct mult_functor { int a; }; -struct adaptable_mult_functor +struct adaptable_mult_functor : mult_functor { typedef int result_type; @@ -249,7 +249,7 @@ main() ); boost::constant_lvalue_iterator_test( - boost::make_transform_iterator((pair_t*)values, const_select_first()), x[0]); + boost::make_transform_iterator((pair_t*)values, const_select_first()), x[0]); boost::non_const_lvalue_iterator_test( boost::make_transform_iterator((pair_t*)values, select_first()), x[0], 17); From dc7bf5cc05a8606d4be9a6481395af08710199fd Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Tue, 31 Mar 2020 11:21:59 -0400 Subject: [PATCH 025/173] Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers. --- include/boost/iterator/counting_iterator.hpp | 2 +- include/boost/iterator/detail/config_def.hpp | 8 ++++---- include/boost/iterator/indirect_iterator.hpp | 2 +- include/boost/pending/iterator_tests.hpp | 2 +- include/boost/pointee.hpp | 2 +- test/counting_iterator_test.cpp | 4 ++-- test/is_lvalue_iterator.cpp | 2 +- test/iterator_adaptor_cc.cpp | 2 +- test/iterator_adaptor_test.cpp | 8 ++++---- test/iterator_traits_test.cpp | 2 +- test/reverse_iterator_test.cpp | 2 +- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/boost/iterator/counting_iterator.hpp b/include/boost/iterator/counting_iterator.hpp index d90980e11..9bb0419d0 100644 --- a/include/boost/iterator/counting_iterator.hpp +++ b/include/boost/iterator/counting_iterator.hpp @@ -38,7 +38,7 @@ namespace detail # else -# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +# if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) BOOST_STATIC_CONSTANT( bool, value = ( boost::is_convertible::value diff --git a/include/boost/iterator/detail/config_def.hpp b/include/boost/iterator/detail/config_def.hpp index 117e75a76..554ae0abd 100644 --- a/include/boost/iterator/detail/config_def.hpp +++ b/include/boost/iterator/detail/config_def.hpp @@ -27,7 +27,7 @@ // because the operator-> return is improperly deduced as a non-const // pointer. #if 1 || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531)) + || BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x531)) // Recall that in general, compilers without partial specialization // can't strip constness. Consider counting_iterator, which normally @@ -46,7 +46,7 @@ #endif -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x5A0)) \ +#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x5A0)) \ || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) \ || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) @@ -88,7 +88,7 @@ #endif #if BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4) && !defined(__EDG_VERSION__) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) + || BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) # define BOOST_NO_IS_CONVERTIBLE_TEMPLATE // The following program fails to compile: # if 0 // test code @@ -114,7 +114,7 @@ # define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY #endif -# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +# if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) // GCC-2.95 (obsolete) eagerly instantiates templated constructors and conversion // operators in convertibility checks, causing premature errors. diff --git a/include/boost/iterator/indirect_iterator.hpp b/include/boost/iterator/indirect_iterator.hpp index 7449d621b..e15ac87e4 100644 --- a/include/boost/iterator/indirect_iterator.hpp +++ b/include/boost/iterator/indirect_iterator.hpp @@ -111,7 +111,7 @@ namespace iterators { private: typename super_t::reference dereference() const { -# if BOOST_WORKAROUND(__BORLANDC__, < 0x5A0 ) +# if BOOST_WORKAROUND(BOOST_BORLANDC, < 0x5A0 ) return const_cast(**this->base()); # else return **this->base(); diff --git a/include/boost/pending/iterator_tests.hpp b/include/boost/pending/iterator_tests.hpp index b4d2efa87..46dc42085 100644 --- a/include/boost/pending/iterator_tests.hpp +++ b/include/boost/pending/iterator_tests.hpp @@ -180,7 +180,7 @@ void forward_iterator_test(Iterator i, T v1, T v2) trivial_iterator_test(i, i2, v2); // borland doesn't allow non-type template parameters -# if !defined(__BORLANDC__) || (__BORLANDC__ > 0x551) +# if !defined(BOOST_BORLANDC) || (BOOST_BORLANDC > 0x551) lvalue_test<(boost::is_pointer::value)>::check(i); #endif } diff --git a/include/boost/pointee.hpp b/include/boost/pointee.hpp index f3bcf446b..69efa940e 100644 --- a/include/boost/pointee.hpp +++ b/include/boost/pointee.hpp @@ -50,7 +50,7 @@ namespace detail BOOST_STATIC_CONSTANT(bool, is_constant = sizeof(impl::test(*impl::x)) == 1); typedef typename mpl::if_c< -# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +# if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) ::boost::detail::iterator_pointee::is_constant # else is_constant diff --git a/test/counting_iterator_test.cpp b/test/counting_iterator_test.cpp index 899b0455c..225cf4e70 100644 --- a/test/counting_iterator_test.cpp +++ b/test/counting_iterator_test.cpp @@ -17,7 +17,7 @@ #include -#ifdef __BORLANDC__ // Borland mis-detects our custom iterators +#ifdef BOOST_BORLANDC // Borland mis-detects our custom iterators # pragma warn -8091 // template argument ForwardIterator passed to '...' is a output iterator # pragma warn -8071 // Conversion may lose significant digits (due to counting_iterator += n). #endif @@ -40,7 +40,7 @@ #include #include #include -#ifndef __BORLANDC__ +#ifndef BOOST_BORLANDC # include #endif #include diff --git a/test/is_lvalue_iterator.cpp b/test/is_lvalue_iterator.cpp index ba880d70b..16de01413 100644 --- a/test/is_lvalue_iterator.cpp +++ b/test/is_lvalue_iterator.cpp @@ -133,7 +133,7 @@ int main() BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator::value); BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); #endif BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator >::value); diff --git a/test/iterator_adaptor_cc.cpp b/test/iterator_adaptor_cc.cpp index 1ab676a29..2ea758256 100644 --- a/test/iterator_adaptor_cc.cpp +++ b/test/iterator_adaptor_cc.cpp @@ -27,7 +27,7 @@ int main() #if defined(__SGI_STL_PORT) \ || !BOOST_WORKAROUND(__GNUC__, <= 2) \ && !(BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 1)) \ - && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) \ + && !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) \ && !BOOST_WORKAROUND(__LIBCOMO_VERSION__, BOOST_TESTED_AT(29)) \ && !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 1) { diff --git a/test/iterator_adaptor_test.cpp b/test/iterator_adaptor_test.cpp index 88a8a1bef..4b37c14b3 100644 --- a/test/iterator_adaptor_test.cpp +++ b/test/iterator_adaptor_test.cpp @@ -56,7 +56,7 @@ struct ptr_iterator , V* , V , boost::random_access_traversal_tag -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) , V& #endif > @@ -67,7 +67,7 @@ struct ptr_iterator , V* , V , boost::random_access_traversal_tag -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) , V& #endif > super_t; @@ -226,7 +226,7 @@ main() # endif #endif -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) // borland drops constness +#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) // borland drops constness test = static_assert_same::value; #endif } @@ -238,7 +238,7 @@ main() test = static_assert_same::value; test = static_assert_same::value; -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) // borland drops constness +#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) // borland drops constness test = static_assert_same::value; #endif diff --git a/test/iterator_traits_test.cpp b/test/iterator_traits_test.cpp index 4dd4e7af7..e4a23aee7 100644 --- a/test/iterator_traits_test.cpp +++ b/test/iterator_traits_test.cpp @@ -153,7 +153,7 @@ struct maybe_pointer_test input_iterator_test, int, std::ptrdiff_t, int*, int&, std::input_iterator_tag> istream_iterator_test; -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x564) && !defined(__SGI_STL_PORT) +#if BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x564) && !defined(__SGI_STL_PORT) typedef ::std::char_traits::off_type distance; non_pointer_test,int, distance,int*,int&,std::output_iterator_tag> ostream_iterator_test; diff --git a/test/reverse_iterator_test.cpp b/test/reverse_iterator_test.cpp index 8ac5e10ef..c2e4a4190 100644 --- a/test/reverse_iterator_test.cpp +++ b/test/reverse_iterator_test.cpp @@ -161,7 +161,7 @@ int main() #if defined(__SGI_STL_PORT) \ || !BOOST_WORKAROUND(__GNUC__, <= 2) \ && !(BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 1)) \ - && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) \ + && !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) \ && !BOOST_WORKAROUND(__LIBCOMO_VERSION__, BOOST_TESTED_AT(29)) \ && !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 1) From b86c817481f745987f37265a2790e31f72bd1d50 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 2 May 2020 02:03:16 +0300 Subject: [PATCH 026/173] Updated function_output_iterator example to use up-to-date header location. --- example/func_output_iter_example.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/func_output_iter_example.cpp b/example/func_output_iter_example.cpp index 8a76b7f2c..47a989a84 100644 --- a/example/func_output_iter_example.cpp +++ b/example/func_output_iter_example.cpp @@ -12,7 +12,7 @@ #include #include -#include +#include struct string_appender { From 8fc94469da2a5ac040d8ca69db0cc4de1265f25f Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 5 May 2020 23:20:14 +0300 Subject: [PATCH 027/173] Added clang-10 jobs to Travis CI. --- .travis.yml | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index b3289de75..4ab763bab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -303,48 +303,62 @@ matrix: - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + - os: linux + dist: xenial + compiler: clang-10 + env: TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20 + addons: + apt: + packages: + - clang-10 + - libstdc++-9-dev + sources: + - sourceline: "ppa:ubuntu-toolchain-r/test" + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" + key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" + - os: linux dist: xenial compiler: clang-UBSAN - env: UBSAN=1 TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1 + env: UBSAN=1 TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20 UBSAN_OPTIONS=print_stacktrace=1 addons: apt: packages: - - clang-9 + - clang-10 - libstdc++-9-dev sources: - sourceline: "ppa:ubuntu-toolchain-r/test" - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - os: linux dist: xenial compiler: clang-libc++ - env: TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a CXXFLAGS="-stdlib=libc++" LINKFLAGS="-stdlib=libc++" + env: TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20 CXXFLAGS="-stdlib=libc++" LINKFLAGS="-stdlib=libc++" addons: apt: packages: - - clang-9 - - libc++-9-dev - - libc++abi-9-dev + - clang-10 + - libc++-10-dev + - libc++abi-10-dev sources: - sourceline: "ppa:ubuntu-toolchain-r/test" - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - os: linux dist: xenial compiler: clang-libc++-UBSAN - env: UBSAN=1 TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1 CXXFLAGS="-stdlib=libc++" LINKFLAGS="-stdlib=libc++" + env: UBSAN=1 TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20 UBSAN_OPTIONS=print_stacktrace=1 CXXFLAGS="-stdlib=libc++" LINKFLAGS="-stdlib=libc++" addons: apt: packages: - - clang-9 - - libc++-9-dev - - libc++abi-9-dev + - clang-10 + - libc++-10-dev + - libc++abi-10-dev sources: - sourceline: "ppa:ubuntu-toolchain-r/test" - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" + - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" # clang, OS X From da8604615efb0bf28d590d97776c13cf3f37aeac Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 10 May 2020 23:02:42 +0300 Subject: [PATCH 028/173] Removed the use of deprecated header boost/detail/iterator.hpp --- test/counting_iterator_test.cpp | 2 -- test/iterator_traits_test.cpp | 1 - 2 files changed, 3 deletions(-) diff --git a/test/counting_iterator_test.cpp b/test/counting_iterator_test.cpp index 225cf4e70..8f8da5fce 100644 --- a/test/counting_iterator_test.cpp +++ b/test/counting_iterator_test.cpp @@ -26,13 +26,11 @@ # pragma warning(disable:4786) // identifier truncated in debug info #endif -#include #include #include #include #include -#include #include #include diff --git a/test/iterator_traits_test.cpp b/test/iterator_traits_test.cpp index e4a23aee7..1beb62d98 100644 --- a/test/iterator_traits_test.cpp +++ b/test/iterator_traits_test.cpp @@ -20,7 +20,6 @@ // reference type from operator* (David Abrahams) // 19 Jan 2001 Initial version with iterator operators (David Abrahams) -#include #include #include #include From 5b18ae976eee68ada71df39650fda2c4570e1186 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 10 May 2020 23:08:14 +0300 Subject: [PATCH 029/173] Updated code to use distance and iterator_traits from std. --- test/counting_iterator_test.cpp | 6 +++--- test/iterator_traits_test.cpp | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/test/counting_iterator_test.cpp b/test/counting_iterator_test.cpp index 8f8da5fce..0b1db7bff 100644 --- a/test/counting_iterator_test.cpp +++ b/test/counting_iterator_test.cpp @@ -86,9 +86,9 @@ void category_test( std::random_access_iterator_tag) { typedef typename - boost::detail::iterator_traits::difference_type + std::iterator_traits::difference_type difference_type; - difference_type distance = boost::detail::distance(start, finish); + difference_type distance = std::distance(start, finish); // Pick a random position internal to the range difference_type offset = (unsigned)rand() % distance; @@ -110,7 +110,7 @@ void category_test( std::equal_range(start, finish, *internal)); CountingIterator x = xy.first, y = xy.second; - BOOST_TEST(boost::detail::distance(x, y) == 1); + BOOST_TEST(std::distance(x, y) == 1); // Show that values outside the range can't be found BOOST_TEST(!std::binary_search(start, boost::prior(finish), *finish)); diff --git a/test/iterator_traits_test.cpp b/test/iterator_traits_test.cpp index 1beb62d98..f937f67b3 100644 --- a/test/iterator_traits_test.cpp +++ b/test/iterator_traits_test.cpp @@ -76,7 +76,7 @@ struct my_iterator2 // Used to prove that we're not overly confused by the existence of // std::iterator<> in the hierarchy under MSVC6 - we should find that -// boost::detail::iterator_traits::difference_type is int. +// std::iterator_traits::difference_type is int. struct my_iterator3 : my_iterator1 { typedef int difference_type; @@ -107,8 +107,8 @@ template struct non_portable_tests { - typedef typename boost::detail::iterator_traits::pointer test_pt; - typedef typename boost::detail::iterator_traits::reference test_rt; + typedef typename std::iterator_traits::pointer test_pt; + typedef typename std::iterator_traits::reference test_rt; typedef typename assert_same::type a1; typedef typename assert_same::type a2; }; @@ -117,8 +117,8 @@ template struct portable_tests { - typedef typename boost::detail::iterator_traits::difference_type test_dt; - typedef typename boost::detail::iterator_traits::iterator_category test_cat; + typedef typename std::iterator_traits::difference_type test_dt; + typedef typename std::iterator_traits::iterator_category test_cat; typedef typename assert_same::type a1; typedef typename assert_same::type a2; }; @@ -129,7 +129,7 @@ template { - typedef typename boost::detail::iterator_traits::value_type test_vt; + typedef typename std::iterator_traits::value_type test_vt; typedef typename assert_same::type a1; }; @@ -203,15 +203,15 @@ int main() for (int length = 3; length < 100; length += length / 3) { std::list l(length); - BOOST_TEST(boost::detail::distance(l.begin(), l.end()) == length); + BOOST_TEST(std::distance(l.begin(), l.end()) == length); std::vector v(length); - BOOST_TEST(boost::detail::distance(v.begin(), v.end()) == length); + BOOST_TEST(std::distance(v.begin(), v.end()) == length); - BOOST_TEST(boost::detail::distance(&ints[0], ints + length) == length); - BOOST_TEST(boost::detail::distance(my_iterator1(chars), my_iterator1(chars + length)) == length); - BOOST_TEST(boost::detail::distance(my_iterator2(chars), my_iterator2(chars + length)) == length); - BOOST_TEST(boost::detail::distance(my_iterator3(chars), my_iterator3(chars + length)) == length); + BOOST_TEST(std::distance(&ints[0], ints + length) == length); + BOOST_TEST(std::distance(my_iterator1(chars), my_iterator1(chars + length)) == length); + BOOST_TEST(std::distance(my_iterator2(chars), my_iterator2(chars + length)) == length); + BOOST_TEST(std::distance(my_iterator3(chars), my_iterator3(chars + length)) == length); } return boost::report_errors(); } From 733c0fb9cb817ca2f1077907c985d6cd4fd66b6d Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 22 May 2020 18:41:15 +0300 Subject: [PATCH 030/173] Added gcc 10 build jobs to Travis CI. --- .travis.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4ab763bab..56adae565 100644 --- a/.travis.yml +++ b/.travis.yml @@ -137,14 +137,25 @@ matrix: sources: - sourceline: "ppa:ubuntu-toolchain-r/test" + - os: linux + dist: bionic + compiler: gcc-10 + env: TOOLSET=gcc COMPILER=g++-10 CXXSTD=03,11,14,17,20 + addons: + apt: + packages: + - g++-10 + sources: + - sourceline: "ppa:ubuntu-toolchain-r/test" + - os: linux dist: bionic compiler: gcc-UBSAN - env: UBSAN=1 TOOLSET=gcc COMPILER=g++-9 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold + env: UBSAN=1 TOOLSET=gcc COMPILER=g++-10 CXXSTD=03,11,14,17,20 UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold addons: apt: packages: - - g++-9 + - g++-10 sources: - sourceline: "ppa:ubuntu-toolchain-r/test" From d7ad43a925c15b3e30ec21979c7b4f4f0f87c255 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 23 May 2020 19:57:54 +0300 Subject: [PATCH 031/173] Updated to support C++20 ostream_iterator::difference_type on gcc 10. --- test/iterator_traits_test.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/iterator_traits_test.cpp b/test/iterator_traits_test.cpp index f937f67b3..467373ad9 100644 --- a/test/iterator_traits_test.cpp +++ b/test/iterator_traits_test.cpp @@ -152,6 +152,13 @@ struct maybe_pointer_test input_iterator_test, int, std::ptrdiff_t, int*, int&, std::input_iterator_tag> istream_iterator_test; +// C++20 changed ostream_iterator::difference_type to ptrdiff_t. +#if __cplusplus >= 202002L && (\ + (defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION >= 100100) \ + ) +#define BOOST_ITERATOR_CXX20_OSTREAM_ITERATOR +#endif + #if BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x564) && !defined(__SGI_STL_PORT) typedef ::std::char_traits::off_type distance; non_pointer_test,int, @@ -164,6 +171,10 @@ non_pointer_test, non_pointer_test, int, long, int*, int&, std::output_iterator_tag> ostream_iterator_test; +#elif defined(BOOST_ITERATOR_CXX20_OSTREAM_ITERATOR) +non_pointer_test, + void, std::ptrdiff_t, void, void, std::output_iterator_tag> + ostream_iterator_test; #else non_pointer_test, void, void, void, void, std::output_iterator_tag> From 72f0ebe8d06991968c6f792c0a846519a795cac1 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 24 May 2020 00:29:51 +0300 Subject: [PATCH 032/173] Adjusted the check for C++20 on gcc 10. The compiler defines __cplusplus to a non-standard value less than 202002 in C++20 mode. --- test/iterator_traits_test.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/iterator_traits_test.cpp b/test/iterator_traits_test.cpp index 467373ad9..7abf56a80 100644 --- a/test/iterator_traits_test.cpp +++ b/test/iterator_traits_test.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -153,7 +154,8 @@ input_iterator_test, int, std::ptrdiff_t, int*, int&, istream_iterator_test; // C++20 changed ostream_iterator::difference_type to ptrdiff_t. -#if __cplusplus >= 202002L && (\ +// Note: gcc 10.1 defines __cplusplus to a value less than 202002L, but greater than 201703L in C++20 mode. +#if __cplusplus > 201703L && (\ (defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION >= 100100) \ ) #define BOOST_ITERATOR_CXX20_OSTREAM_ITERATOR From 32f4f4d08628403b783f598922542dc66299e9c5 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Tue, 13 Oct 2020 19:23:49 -0700 Subject: [PATCH 033/173] MSVC also has C++20 output_iterator Tell iterator_traits_test not to fail on MSVC when `std::output_iterator` has `difference_type` of `std::ptrdiff_t`. --- test/iterator_traits_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/iterator_traits_test.cpp b/test/iterator_traits_test.cpp index 7abf56a80..cbfedd799 100644 --- a/test/iterator_traits_test.cpp +++ b/test/iterator_traits_test.cpp @@ -157,7 +157,8 @@ input_iterator_test, int, std::ptrdiff_t, int*, int&, // Note: gcc 10.1 defines __cplusplus to a value less than 202002L, but greater than 201703L in C++20 mode. #if __cplusplus > 201703L && (\ (defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION >= 100100) \ - ) + ) || \ + defined(_MSVC_LANG) && _MSVC_LANG > 201703L && _MSVC_STL_UPDATE >= 202010L #define BOOST_ITERATOR_CXX20_OSTREAM_ITERATOR #endif From 987151dde66a9392ef814fcb0a2d8c503232ae0a Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Tue, 19 Jan 2021 23:19:27 -0500 Subject: [PATCH 034/173] [skip ci] Add "cxxstd" json field. The "cxxstd" json field is being added to each Boost library's meta json information for libraries in order to specify the minumum C++ standard compilation level. The value of this field matches one of the values for 'cxxstd' in Boost.Build. The purpose of doing this is to provide information for the Boost website documentation for each library which will specify the minimum C++ standard compilation that an end-user must employ in order to use the particular library. This will aid end-users who want to know if they can successfully use a Boost library based on their C++ compiler's compilation level, without having to search the library's documentation to find this out. --- meta/libraries.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/libraries.json b/meta/libraries.json index 537d803fb..34c9d4843 100644 --- a/meta/libraries.json +++ b/meta/libraries.json @@ -14,5 +14,6 @@ "David Abrahams ", "Thomas Witt ", "Jeffrey Lee Hellrung Jr. " - ] + ], + "cxxstd": "03" } From f4b47fd266e1db43ce8480388708a8ecd9532def Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Mon, 7 Jun 2021 22:03:32 -0400 Subject: [PATCH 035/173] Switch from deprecated test to Lightweight Test --- test/permutation_iterator_test.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/permutation_iterator_test.cpp b/test/permutation_iterator_test.cpp index 6fbeaadd0..81cdefedc 100644 --- a/test/permutation_iterator_test.cpp +++ b/test/permutation_iterator_test.cpp @@ -5,7 +5,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include +#include #include #include @@ -59,14 +59,14 @@ void permutation_test() permutation_type it = begin; permutation_type end = boost::make_permutation_iterator( elements.begin(), indices.end() ); - BOOST_CHECK( it == begin ); - BOOST_CHECK( it != end ); + BOOST_TEST( it == begin ); + BOOST_TEST( it != end ); - BOOST_CHECK( std::distance( begin, end ) == index_size ); + BOOST_TEST( std::distance( begin, end ) == index_size ); for( index_type::iterator i_it1 = indices.begin(); it != end; ++i_it1, ++it ) { - BOOST_CHECK( *it == elements[ *i_it1 ] ); + BOOST_TEST( *it == elements[ *i_it1 ] ); } it = begin; @@ -74,14 +74,14 @@ void permutation_test() { index_type::iterator i_it2 = indices.begin(); std::advance( i_it2, i1 ); - BOOST_CHECK( *it == elements[ *i_it2 ] ); + BOOST_TEST( *it == elements[ *i_it2 ] ); } it = begin; std::advance(it, index_size); for( index_type::iterator i_it3 = indices.end(); it != begin; ) { - BOOST_CHECK( *--it == elements[ *--i_it3 ] ); + BOOST_TEST( *--it == elements[ *--i_it3 ] ); } it = begin; @@ -90,14 +90,14 @@ void permutation_test() { index_type::iterator i_it4 = --indices.end(); std::advance( i_it4, -i2 ); - BOOST_CHECK( *--it == elements[ *i_it4 ] ); + BOOST_TEST( *--it == elements[ *i_it4 ] ); } } -int test_main(int, char *[]) +int main() { permutation_test(); - return 0; + return boost::report_errors(); } From 72a7fb1b7372cf18df331e0ebbfb555f244c03fe Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 10 Jun 2021 00:56:31 +0300 Subject: [PATCH 036/173] Update CMakeLists.txt --- CMakeLists.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aab275154..33a69b213 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,12 +3,9 @@ # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt -# Partial (add_subdirectory only) and experimental CMake support -# Subject to change; please do not rely on the contents of this file yet. +cmake_minimum_required(VERSION 3.5...3.20) -cmake_minimum_required(VERSION 3.5) - -project(BoostIterator LANGUAGES CXX) +project(boost_iterator VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) add_library(boost_iterator INTERFACE) add_library(Boost::iterator ALIAS boost_iterator) From 6dfb175cefd9b53f9da905bdaf75a621821e39f2 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Tue, 31 Aug 2021 19:19:57 +0200 Subject: [PATCH 037/173] supressed spurious type-limits warning See https://github.com/boostorg/iterator/pull/66 for details. --- include/boost/iterator/advance.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/boost/iterator/advance.hpp b/include/boost/iterator/advance.hpp index 92af8fbfe..2b742565f 100644 --- a/include/boost/iterator/advance.hpp +++ b/include/boost/iterator/advance.hpp @@ -8,6 +8,7 @@ #define BOOST_ITERATOR_ADVANCE_HPP #include +#include #include namespace boost { @@ -28,6 +29,12 @@ namespace iterators { } } +#if BOOST_WORKAROUND(BOOST_GCC_VERSION, >= 40600) +// type-limits warning issued below when n is an unsigned integral +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" +#endif + template inline BOOST_CXX14_CONSTEXPR void advance_impl( @@ -50,6 +57,10 @@ namespace iterators { } } +#if BOOST_WORKAROUND(BOOST_GCC_VERSION, >= 40600) +#pragma GCC diagnostic pop +#endif + template inline BOOST_CXX14_CONSTEXPR void advance_impl( From f396a8fef0dd33e8d3111f328f7cf9d16211a4db Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 12 Sep 2021 19:59:52 +0300 Subject: [PATCH 038/173] Removed Travis CI config. Since Travis CI no longer runs free jobs for open source projects, we are switching to GitHub Actions instead. --- .travis.yml | 415 ---------------------------------------------------- 1 file changed, 415 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 56adae565..000000000 --- a/.travis.yml +++ /dev/null @@ -1,415 +0,0 @@ -# Copyright 2016, 2017 Peter Dimov -# Copyright 2019 Andrey Semashev -# 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: -# gcc, Linux -# Note: gcc-4.4 in C++0x mode fails zip_iterator tests with std::tuple - - os: linux - dist: trusty - compiler: gcc-4.4 - env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98 - addons: - apt: - packages: - - g++-4.4 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: gcc-4.6 - env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x - addons: - apt: - packages: - - g++-4.6 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: trusty - compiler: gcc-4.7 - env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11 - addons: - apt: - packages: - - g++-4.7 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: xenial - compiler: gcc-4.8 - env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11 - addons: - apt: - packages: - - g++-4.8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: xenial - compiler: gcc-4.9 - env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11 - addons: - apt: - packages: - - g++-4.9 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: xenial - compiler: gcc-5 - env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z - addons: - apt: - packages: - - g++-5 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: xenial - compiler: gcc-6 - env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z - addons: - apt: - packages: - - g++-6 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: xenial - compiler: gcc-7 - env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17 - addons: - apt: - packages: - - g++-7 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: xenial - compiler: gcc-8 - env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17,2a - addons: - apt: - packages: - - g++-8 - sources: - - ubuntu-toolchain-r-test - - - os: linux - dist: bionic - compiler: gcc-9 - env: TOOLSET=gcc COMPILER=g++-9 CXXSTD=03,11,14,17,2a - addons: - apt: - packages: - - g++-9 - sources: - - sourceline: "ppa:ubuntu-toolchain-r/test" - - - os: linux - dist: bionic - compiler: gcc-10 - env: TOOLSET=gcc COMPILER=g++-10 CXXSTD=03,11,14,17,20 - addons: - apt: - packages: - - g++-10 - sources: - - sourceline: "ppa:ubuntu-toolchain-r/test" - - - os: linux - dist: bionic - compiler: gcc-UBSAN - env: UBSAN=1 TOOLSET=gcc COMPILER=g++-10 CXXSTD=03,11,14,17,20 UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold - addons: - apt: - packages: - - g++-10 - sources: - - sourceline: "ppa:ubuntu-toolchain-r/test" - -# clang, Linux - - os: linux - dist: trusty - compiler: clang-3.5 - env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11 - addons: - apt: - packages: - - clang-3.5 - - libstdc++-4.9-dev - sources: - - ubuntu-toolchain-r-test - - sourceline: "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.5 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - os: linux - dist: trusty - compiler: clang-3.6 - env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11 - addons: - apt: - packages: - - clang-3.6 - - libstdc++-5-dev - sources: - - ubuntu-toolchain-r-test - - sourceline: "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.6 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - os: linux - dist: trusty - compiler: clang-3.7 - env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11 - addons: - apt: - packages: - - clang-3.7 - - libstdc++-5-dev - sources: - - ubuntu-toolchain-r-test - - sourceline: "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.7 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - os: linux - dist: xenial - compiler: clang-3.8 - env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z - addons: - apt: - packages: - - clang-3.8 - - libstdc++-6-dev - sources: - - ubuntu-toolchain-r-test - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.8 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - os: linux - dist: xenial - compiler: clang-3.9 - env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z - addons: - apt: - packages: - - clang-3.9 - - libstdc++-6-dev - sources: - - ubuntu-toolchain-r-test - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - os: linux - dist: xenial - compiler: clang-4 - env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z - addons: - apt: - packages: - - clang-4.0 - - libstdc++-6-dev - sources: - - ubuntu-toolchain-r-test - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - os: linux - dist: xenial - compiler: clang-5 - env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z - addons: - apt: - packages: - - clang-5.0 - - libstdc++-7-dev - sources: - - ubuntu-toolchain-r-test - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - os: linux - dist: xenial - compiler: clang-6 - env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17,2a - addons: - apt: - packages: - - clang-6.0 - - libstdc++-8-dev - sources: - - ubuntu-toolchain-r-test - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - os: linux - dist: xenial - compiler: clang-7 - env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17,2a - addons: - apt: - packages: - - clang-7 - - libstdc++-8-dev - sources: - - ubuntu-toolchain-r-test - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - os: linux - dist: xenial - compiler: clang-8 - env: TOOLSET=clang COMPILER=clang++-8 CXXSTD=03,11,14,17,2a - addons: - apt: - packages: - - clang-8 - - libstdc++-8-dev - sources: - - ubuntu-toolchain-r-test - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - os: linux - dist: xenial - compiler: clang-9 - env: TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a - addons: - apt: - packages: - - clang-9 - - libstdc++-9-dev - sources: - - sourceline: "ppa:ubuntu-toolchain-r/test" - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - os: linux - dist: xenial - compiler: clang-10 - env: TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20 - addons: - apt: - packages: - - clang-10 - - libstdc++-9-dev - sources: - - sourceline: "ppa:ubuntu-toolchain-r/test" - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - os: linux - dist: xenial - compiler: clang-UBSAN - env: UBSAN=1 TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20 UBSAN_OPTIONS=print_stacktrace=1 - addons: - apt: - packages: - - clang-10 - - libstdc++-9-dev - sources: - - sourceline: "ppa:ubuntu-toolchain-r/test" - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - os: linux - dist: xenial - compiler: clang-libc++ - env: TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20 CXXFLAGS="-stdlib=libc++" LINKFLAGS="-stdlib=libc++" - addons: - apt: - packages: - - clang-10 - - libc++-10-dev - - libc++abi-10-dev - sources: - - sourceline: "ppa:ubuntu-toolchain-r/test" - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - - - os: linux - dist: xenial - compiler: clang-libc++-UBSAN - env: UBSAN=1 TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20 UBSAN_OPTIONS=print_stacktrace=1 CXXFLAGS="-stdlib=libc++" LINKFLAGS="-stdlib=libc++" - addons: - apt: - packages: - - clang-10 - - libc++-10-dev - - libc++abi-10-dev - sources: - - sourceline: "ppa:ubuntu-toolchain-r/test" - - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - -# clang, OS X -# OS X builds are slow on Travis CI -# - os: osx -# env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z -# osx_image: xcode9.4 -# -# - os: osx -# env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z -# osx_image: xcode10.3 - - - os: osx - env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,17 - osx_image: xcode11.2 - -install: - - GIT_FETCH_JOBS=8 - - BOOST_BRANCH=develop - - if [ "$TRAVIS_BRANCH" = "master" ]; then BOOST_BRANCH=master; fi - - cd .. - - git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root - - cd boost-root - - git submodule init tools/build - - git submodule init tools/boostdep - - git submodule init tools/boost_install - - git submodule init libs/headers - - git submodule init libs/config - - git submodule update --jobs $GIT_FETCH_JOBS - - cp -r $TRAVIS_BUILD_DIR/* libs/iterator - - python tools/boostdep/depinst/depinst.py --git_args "--jobs $GIT_FETCH_JOBS" iterator - - ./bootstrap.sh - - ./b2 headers - -script: - - |- - echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam - - BUILD_JOBS=`(nproc || sysctl -n hw.ncpu) 2> /dev/null` - - ./b2 -j $BUILD_JOBS libs/iterator/test toolset=$TOOLSET cxxstd=$CXXSTD ${UBSAN:+cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined linkflags=-fsanitize=undefined define=UBSAN=1 debug-symbols=on visibility=global} ${CXXFLAGS:+cxxflags="$CXXFLAGS"} ${LINKFLAGS:+linkflags="$LINKFLAGS"} - -notifications: - email: - on_success: always From b76c2739461888145b9a79b3112c7ff0226d51d2 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 12 Sep 2021 20:01:33 +0300 Subject: [PATCH 039/173] Added GitHub Actions config. --- .github/workflows/ci.yml | 416 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 416 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..207ecf34f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,416 @@ +# Copyright 2021 Andrey Semashev +# +# 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) + +name: CI + +on: + pull_request: + push: + branches: + - master + - develop + - feature/** + +concurrency: + group: ${{format('{0}:{1}', github.repository, github.ref)}} + cancel-in-progress: true + +env: + GIT_FETCH_JOBS: 8 + NET_RETRY_COUNT: 5 + DEFAULT_BUILD_VARIANT: debug,release + +jobs: + posix: + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + include: + # Linux, gcc + - toolset: gcc-4.4 + cxxstd: "98,0x" + os: ubuntu-20.04 + container: ubuntu:16.04 + install: + - g++-4.4 + sources: + - "ppa:ubuntu-toolchain-r/test" + - toolset: gcc-4.6 + cxxstd: "03,0x" + os: ubuntu-20.04 + container: ubuntu:16.04 + install: + - g++-4.6 + sources: + - "ppa:ubuntu-toolchain-r/test" + - toolset: gcc-4.7 + cxxstd: "03,11" + os: ubuntu-20.04 + container: ubuntu:16.04 + install: + - g++-4.7 + - toolset: gcc-4.8 + cxxstd: "03,11" + os: ubuntu-18.04 + install: + - g++-4.8 + - toolset: gcc-4.9 + cxxstd: "03,11" + os: ubuntu-20.04 + container: ubuntu:16.04 + install: + - g++-4.9 + - toolset: gcc-5 + cxxstd: "03,11,14,1z" + os: ubuntu-20.04 + container: ubuntu:16.04 + install: + - g++-5 + - toolset: gcc-6 + cxxstd: "03,11,14,1z" + os: ubuntu-18.04 + install: + - g++-6 + - toolset: gcc-7 + cxxstd: "03,11,14,17" + os: ubuntu-18.04 + install: + - g++-7 + - toolset: gcc-8 + cxxstd: "03,11,14,17,2a" + os: ubuntu-18.04 + install: + - g++-8 + - toolset: gcc-9 + cxxstd: "03,11,14,17,2a" + os: ubuntu-18.04 + install: + - g++-9 + - toolset: gcc-10 + cxxstd: "03,11,14,17,20" + os: ubuntu-20.04 + install: + - g++-10 + - toolset: gcc-11 + cxxstd: "03,11,14,17,20" + os: ubuntu-20.04 + install: + - g++-11 + sources: + - "ppa:ubuntu-toolchain-r/test" + - name: UBSAN + toolset: gcc-11 + cxxstd: "03,11,14,17,20" + ubsan: 1 + build_variant: debug + os: ubuntu-20.04 + install: + - g++-11 + sources: + - "ppa:ubuntu-toolchain-r/test" + + # Linux, clang + - toolset: clang + compiler: clang++-3.5 + cxxstd: "03,11" + os: ubuntu-20.04 + container: ubuntu:16.04 + install: + - clang-3.5 + - toolset: clang + compiler: clang++-3.6 + cxxstd: "03,11,14" + os: ubuntu-20.04 + container: ubuntu:16.04 + install: + - clang-3.6 + - toolset: clang + compiler: clang++-3.7 + cxxstd: "03,11,14" + os: ubuntu-20.04 + container: ubuntu:16.04 + install: + - clang-3.7 + - toolset: clang + compiler: clang++-3.8 + cxxstd: "03,11,14" + os: ubuntu-20.04 + container: ubuntu:16.04 + install: + - clang-3.8 + - toolset: clang + compiler: clang++-3.9 + cxxstd: "03,11,14" + os: ubuntu-18.04 + install: + - clang-3.9 + - toolset: clang + compiler: clang++-4.0 + cxxstd: "03,11,14" + os: ubuntu-18.04 + install: + - clang-4.0 + - toolset: clang + compiler: clang++-5.0 + cxxstd: "03,11,14,1z" + os: ubuntu-18.04 + install: + - clang-5.0 + - toolset: clang + compiler: clang++-6.0 + cxxstd: "03,11,14,17" + os: ubuntu-18.04 + install: + - clang-6.0 + - toolset: clang + compiler: clang++-7 + cxxstd: "03,11,14,17" + os: ubuntu-18.04 + install: + - clang-7 + # Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode + - toolset: clang + compiler: clang++-8 + cxxstd: "03,11,14,17,2a" + os: ubuntu-18.04 + install: + - clang-8 + - g++-7 + gcc_toolchain: 7 + - toolset: clang + compiler: clang++-9 + cxxstd: "03,11,14,17,2a" + os: ubuntu-20.04 + install: + - clang-9 + - toolset: clang + compiler: clang++-10 + cxxstd: "03,11,14,17,20" + os: ubuntu-20.04 + install: + - clang-10 + - toolset: clang + compiler: clang++-11 + cxxstd: "03,11,14,17,20" + os: ubuntu-20.04 + install: + - clang-11 + - toolset: clang + compiler: clang++-12 + cxxstd: "03,11,14,17,20" + os: ubuntu-20.04 + install: + - clang-12 + - toolset: clang + compiler: clang++-12 + cxxstd: "03,11,14,17,20" + os: ubuntu-20.04 + install: + - clang-12 + - libc++-12-dev + - libc++abi-12-dev + cxxflags: -stdlib=libc++ + linkflags: -stdlib=libc++ + - name: UBSAN + toolset: clang + compiler: clang++-12 + cxxstd: "03,11,14,17,20" + cxxflags: -stdlib=libc++ + linkflags: -stdlib=libc++ + ubsan: 1 + build_variant: debug + os: ubuntu-20.04 + install: + - clang-12 + - libc++-12-dev + - libc++abi-12-dev + + - toolset: clang + cxxstd: "03,11,14,17,2a" + os: macos-10.15 + + - name: CMake tests + cmake_tests: 1 + os: ubuntu-20.04 + + runs-on: ${{matrix.os}} + container: ${{matrix.container}} + + steps: + - name: Setup environment + run: | + if [ -f "/etc/debian_version" ] + then + echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV + export DEBIAN_FRONTEND=noninteractive + fi + if [ -n "${{matrix.container}}" ] + then + echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV + if [ -f "/etc/debian_version" ] + then + apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ python python3 git cmake + fi + fi + git config --global pack.threads 0 + + - uses: actions/checkout@v2 + + - name: Install packages + if: matrix.install + run: | + SOURCE_KEYS=(${{join(matrix.source_keys, ' ')}}) + SOURCES=(${{join(matrix.sources, ' ')}}) + for key in "${SOURCE_KEYS[@]}" + do + for i in {1..$NET_RETRY_COUNT} + do + wget -O - "$key" | sudo apt-key add - && break || sleep 2 + done + done + if [ ${#SOURCES[@]} -gt 0 ] + then + APT_ADD_REPO_COMMON_ARGS=("-y") + APT_ADD_REPO_HAS_SOURCE_ARGS=0 + SOFTWARE_PROPERTIES_VERSION="$(dpkg-query --showformat='${Version}' --show software-properties-common)" + if dpkg --compare-versions "$SOFTWARE_PROPERTIES_VERSION" ge "0.96.24.20" + then + APT_ADD_REPO_COMMON_ARGS+=("-n") + fi + if dpkg --compare-versions "$SOFTWARE_PROPERTIES_VERSION" ge "0.98.10" + then + APT_ADD_REPO_HAS_SOURCE_ARGS=1 + fi + for source in "${SOURCES[@]}" + do + for i in {1..$NET_RETRY_COUNT} + do + APT_ADD_REPO_ARGS=("${APT_ADD_REPO_COMMON_ARGS[@]}") + if [ $APT_ADD_REPO_HAS_SOURCE_ARGS -ne 0 ] + then + case "$source" in + "ppa:"*) + APT_ADD_REPO_ARGS+=("-P") + ;; + "deb "*) + APT_ADD_REPO_ARGS+=("-S") + ;; + *) + APT_ADD_REPO_ARGS+=("-U") + ;; + esac + fi + APT_ADD_REPO_ARGS+=("$source") + sudo -E apt-add-repository "${APT_ADD_REPO_ARGS[@]}" && break || sleep 2 + done + done + fi + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}} + + - name: Setup GCC Toolchain + if: matrix.gcc_toolchain + run: | + GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" + echo "GCC_TOOLCHAIN_ROOT=\"$GCC_TOOLCHAIN_ROOT\"" >> $GITHUB_ENV + MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" + mkdir -p "$GCC_TOOLCHAIN_ROOT" + ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" + ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" + mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" + ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" + + - name: Setup Boost + run: | + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null) + echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV + echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV + DEPINST_ARGS=() + GIT_VERSION="$(git --version | sed -e 's/git version //')" + if $(dpkg --compare-versions "$GIT_VERSION" ge 2.8.0) + then + DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS") + fi + cd .. + git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root" + cd boost-root + mkdir -p libs/$LIBRARY + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + DEPINST_ARGS+=("$LIBRARY") + python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" + if [ -z "${{matrix.cmake_tests}}" ] + then + ./bootstrap.sh + ./b2 headers + if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ] + then + echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam + if [ -n "$GCC_TOOLCHAIN_ROOT" ] + then + echo -n " : \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam + fi + echo " ;" >> ~/user-config.jam + fi + fi + + - name: Run tests + if: matrix.cmake_tests == '' + run: | + cd ../boost-root + B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}") + if [ -n "${{matrix.build_variant}}" ] + then + B2_ARGS+=("variant=${{matrix.build_variant}}") + else + B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT") + fi + if [ -n "${{matrix.threading}}" ] + then + B2_ARGS+=("threading=${{matrix.threading}}") + fi + if [ -n "${{matrix.ubsan}}" ] + then + export UBSAN_OPTIONS="print_stacktrace=1" + B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global") + fi + if [ -n "${{matrix.cxxflags}}" ] + then + B2_ARGS+=("cxxflags=${{matrix.cxxflags}}") + fi + if [ -n "${{matrix.linkflags}}" ] + then + B2_ARGS+=("linkflags=${{matrix.linkflags}}") + fi + B2_ARGS+=("libs/$LIBRARY/test") + ./b2 "${B2_ARGS[@]}" + + - name: Run CMake tests + if: matrix.cmake_tests + run: | + cd ../boost-root + mkdir __build_static__ && cd __build_static__ + cmake ../libs/$LIBRARY/test/test_cmake + cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS + cd .. + mkdir __build_shared__ && cd __build_shared__ + cmake -DBUILD_SHARED_LIBS=On ../libs/$LIBRARY/test/test_cmake + cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS From fc281fa58a0b7075e126193336251488848cf22c Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 12 Sep 2021 20:06:50 +0300 Subject: [PATCH 040/173] Added a README.md file. --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 000000000..d6c6cc188 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# Boost.Iterator + +Boost.Iterator, part of collection of the [Boost C++ Libraries](https://github.com/boostorg), provides tools for building and working with iterators in C++. The library also provides a number of iterator classes that can be used out of the box. + +### Directories + +* **doc** - Documentation sources +* **include** - Interface headers of Boost.Iterator +* **test** - Boost.Iterator unit tests +* **example** - Boost.Iterator usage examples + +### More information + +* [Documentation](https://boost.org/libs/iterator) +* [Report bugs](https://github.com/boostorg/iterator/issues/new). Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. +* Submit your patches as [pull requests](https://github.com/boostorg/iterator/compare) against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt). + +### Build status + +Branch | GitHub Actions | AppVeyor | Test Matrix | Dependencies | +:-------------: | -------------- | -------- | ----------- | ------------ | +[`master`](https://github.com/boostorg/iterator/tree/master) | [![GitHub Actions](https://github.com/boostorg/iterator/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/iterator/actions?query=branch%3Amaster) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/ud8ug5aai8vd30hg?svg=true)](https://ci.appveyor.com/project/Lastique/iterator/branch/master) | [![Tests](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/iterator.html) | [![Dependencies](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/iterator.html) +[`develop`](https://github.com/boostorg/iterator/tree/develop) | [![GitHub Actions](https://github.com/boostorg/iterator/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/iterator/actions?query=branch%3Adevelop) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/ud8ug5aai8vd30hg/branch/develop?svg=true)](https://ci.appveyor.com/project/Lastique/iterator/branch/develop) | [![Tests](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/iterator.html) | [![Dependencies](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/iterator.html) + +### License + +Distributed under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt). From 1447c566d1111a082591ee870025e304ad76ee0a Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 12 Sep 2021 20:35:29 +0300 Subject: [PATCH 041/173] Removed CMake tests from GHA config. --- .github/workflows/ci.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 207ecf34f..fa9751097 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -235,10 +235,6 @@ jobs: cxxstd: "03,11,14,17,2a" os: macos-10.15 - - name: CMake tests - cmake_tests: 1 - os: ubuntu-20.04 - runs-on: ${{matrix.os}} container: ${{matrix.container}} @@ -402,15 +398,3 @@ jobs: fi B2_ARGS+=("libs/$LIBRARY/test") ./b2 "${B2_ARGS[@]}" - - - name: Run CMake tests - if: matrix.cmake_tests - run: | - cd ../boost-root - mkdir __build_static__ && cd __build_static__ - cmake ../libs/$LIBRARY/test/test_cmake - cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS - cd .. - mkdir __build_shared__ && cd __build_shared__ - cmake -DBUILD_SHARED_LIBS=On ../libs/$LIBRARY/test/test_cmake - cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS From 18337e990bfa83997dc145496754bfb039ad4fa6 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 12 Sep 2021 22:35:44 +0300 Subject: [PATCH 042/173] Disable zip_iterator test with std::tuple on gcc 4.4. libstdc++ from gcc 4.4 has a broken std::tuple that fails to compile a constructor from a compatible tuple: /usr/include/c++/4.4/tuple: In constructor 'std::_Head_base<_Idx, _Head, false>::_Head_base(_UHead&&) [with _UHead = std::_Head_base<0ul, const int&, false>, long unsigned int _Idx = 0ul, _Head = int]': /usr/include/c++/4.4/tuple:179: instantiated from 'std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(std::_Tuple_impl<_Idx, _UElements ...>&&) [with _UElements = const int&, double&, long unsigned int _Idx = 0ul, _Head = int, _Tail = double]' /usr/include/c++/4.4/tuple:338: instantiated from 'std::tuple<_T1, _T2>::tuple(std::tuple<_U1, _U2>&&) [with _U1 = const int&, _U2 = double&, _T1 = int, _T2 = double]' libs/iterator/test/detail/zip_iterator_test_original.ipp:137: instantiated from here /usr/include/c++/4.4/tuple:94: error: cannot convert 'std::_Head_base<0ul, const int&, false>' to 'int' in initialization --- test/zip_iterator_test2_std_tuple.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/zip_iterator_test2_std_tuple.cpp b/test/zip_iterator_test2_std_tuple.cpp index 95eff8704..91d774854 100644 --- a/test/zip_iterator_test2_std_tuple.cpp +++ b/test/zip_iterator_test2_std_tuple.cpp @@ -1,6 +1,9 @@ #include -#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +// libstdc++ from gcc 4.4 has a broken std::tuple that cannot be constructed from a compatible tuple, +// e.g. std::tuple from std::tuple. +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ + (!defined(BOOST_LIBSTDCXX_VERSION) || BOOST_LIBSTDCXX_VERSION >= 40500) #include #include @@ -14,8 +17,8 @@ #else int main() - { - return 0; - } +{ + return 0; +} #endif From 0a59f555ca44da4bf5e5cb3b09c78edf73831626 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 12 Sep 2021 22:49:46 +0300 Subject: [PATCH 043/173] Added libc++ 12 to the list of standard libs implementing C++20 std::ostream_iterator. --- test/iterator_traits_test.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/iterator_traits_test.cpp b/test/iterator_traits_test.cpp index cbfedd799..6cdb2c621 100644 --- a/test/iterator_traits_test.cpp +++ b/test/iterator_traits_test.cpp @@ -155,10 +155,11 @@ input_iterator_test, int, std::ptrdiff_t, int*, int&, // C++20 changed ostream_iterator::difference_type to ptrdiff_t. // Note: gcc 10.1 defines __cplusplus to a value less than 202002L, but greater than 201703L in C++20 mode. -#if __cplusplus > 201703L && (\ - (defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION >= 100100) \ - ) || \ - defined(_MSVC_LANG) && _MSVC_LANG > 201703L && _MSVC_STL_UPDATE >= 202010L +#if (__cplusplus > 201703L && ( \ + (defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION >= 100100) || \ + (defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 12000) + )) || \ + (defined(_MSVC_LANG) && _MSVC_LANG > 201703L && _MSVC_STL_UPDATE >= 202010L) #define BOOST_ITERATOR_CXX20_OSTREAM_ITERATOR #endif From 1c6f85d4f9dc9dc424598f3a8562f53697f9afc6 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 12 Sep 2021 23:36:59 +0300 Subject: [PATCH 044/173] Fixed a preprocessor condition. --- test/iterator_traits_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/iterator_traits_test.cpp b/test/iterator_traits_test.cpp index 6cdb2c621..40da04973 100644 --- a/test/iterator_traits_test.cpp +++ b/test/iterator_traits_test.cpp @@ -157,7 +157,7 @@ input_iterator_test, int, std::ptrdiff_t, int*, int&, // Note: gcc 10.1 defines __cplusplus to a value less than 202002L, but greater than 201703L in C++20 mode. #if (__cplusplus > 201703L && ( \ (defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION >= 100100) || \ - (defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 12000) + (defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 12000) \ )) || \ (defined(_MSVC_LANG) && _MSVC_LANG > 201703L && _MSVC_STL_UPDATE >= 202010L) #define BOOST_ITERATOR_CXX20_OSTREAM_ITERATOR From c858138495ee4ae977f4d08d2ea45a723a080614 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 13 Sep 2021 10:02:47 +0300 Subject: [PATCH 045/173] Explicitly specify address-model for MSVC. This works around Boost.Build bug: https://github.com/boostorg/build/issues/659 --- appveyor.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 2249a0adc..4483bcec0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,11 @@ branches: environment: matrix: - - TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0 + - TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0 + ADDRMD: 32 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + - TOOLSET: msvc-12.0 + ADDRMD: 32,64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: msvc-14.0 ADDRMD: 32,64 From 216b442d23ce2f6a67b5cc060530fd9f30a453b0 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 15 Sep 2021 21:32:19 +0300 Subject: [PATCH 046/173] Added GHA CI timeout. --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa9751097..c18fb95d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -235,6 +235,7 @@ jobs: cxxstd: "03,11,14,17,2a" os: macos-10.15 + timeout-minutes: 60 runs-on: ${{matrix.os}} container: ${{matrix.container}} From 9124869bcc217c74eee9053500d5814ad4c7bf15 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 15 Sep 2021 22:15:48 +0300 Subject: [PATCH 047/173] Updated link to AppVeyor badge. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d6c6cc188..bba904652 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Boost.Iterator, part of collection of the [Boost C++ Libraries](https://github.c Branch | GitHub Actions | AppVeyor | Test Matrix | Dependencies | :-------------: | -------------- | -------- | ----------- | ------------ | -[`master`](https://github.com/boostorg/iterator/tree/master) | [![GitHub Actions](https://github.com/boostorg/iterator/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/iterator/actions?query=branch%3Amaster) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/ud8ug5aai8vd30hg?svg=true)](https://ci.appveyor.com/project/Lastique/iterator/branch/master) | [![Tests](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/iterator.html) | [![Dependencies](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/iterator.html) +[`master`](https://github.com/boostorg/iterator/tree/master) | [![GitHub Actions](https://github.com/boostorg/iterator/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/iterator/actions?query=branch%3Amaster) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/ud8ug5aai8vd30hg/branch/master?svg=true)](https://ci.appveyor.com/project/Lastique/iterator/branch/master) | [![Tests](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/iterator.html) | [![Dependencies](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/iterator.html) [`develop`](https://github.com/boostorg/iterator/tree/develop) | [![GitHub Actions](https://github.com/boostorg/iterator/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/iterator/actions?query=branch%3Adevelop) | [![AppVeyor](https://ci.appveyor.com/api/projects/status/ud8ug5aai8vd30hg/branch/develop?svg=true)](https://ci.appveyor.com/project/Lastique/iterator/branch/develop) | [![Tests](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/iterator.html) | [![Dependencies](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/iterator.html) ### License From 72308ef7879095a0c009d49a71ec4406048e5736 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 26 Sep 2021 20:40:21 +0300 Subject: [PATCH 048/173] Fixed git version check on Mac OS. --- .github/workflows/ci.yml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c18fb95d1..bd8f7d46f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -342,7 +342,30 @@ jobs: echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV DEPINST_ARGS=() GIT_VERSION="$(git --version | sed -e 's/git version //')" - if $(dpkg --compare-versions "$GIT_VERSION" ge 2.8.0) + GIT_HAS_JOBS=1 + if [ -f "/etc/debian_version" ] + then + if $(dpkg --compare-versions "$GIT_VERSION" lt 2.8.0) + then + GIT_HAS_JOBS=0 + fi + else + declare -a GIT_VER=(${GIT_VERSION//./ }) + declare -a GIT_MIN_VER=(2 8 0) + for ((i=0; i<${#GIT_VER[@]}; i++)) + do + if [ -z "${GIT_MIN_VER[i]}" ] + then + GIT_MIN_VER[i]=0 + fi + if [ "${GIT_VER[i]}" -lt "${GIT_MIN_VER[i]}" ] + then + GIT_HAS_JOBS=0 + break + fi + done + fi + if [ "$GIT_HAS_JOBS" -ne 0 ] then DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS") fi From 5ebbe941be3795ad5a26544dc6ec617a78c552ba Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 16 Nov 2021 00:48:57 +0300 Subject: [PATCH 049/173] Updated check for apt-add-repository capabilities. In Ubuntu 20.04 there appeared an updated version of the software-properties-common package in focal-updates, which ships a newer apt-add-repository version that doesn't support -P/-S/-U command line arguments. Since we cannot rely on package version checks to determine apt-add-repository capabilities, we have to parse its --help output instead. Also, made source list processing more protected against spaces. --- .github/workflows/ci.yml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd8f7d46f..0bc07f6d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -253,7 +253,7 @@ jobs: if [ -f "/etc/debian_version" ] then apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ python python3 git cmake + apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ python python3 perl git cmake fi fi git config --global pack.threads 0 @@ -263,28 +263,32 @@ jobs: - name: Install packages if: matrix.install run: | - SOURCE_KEYS=(${{join(matrix.source_keys, ' ')}}) - SOURCES=(${{join(matrix.sources, ' ')}}) + declare -a SOURCE_KEYS SOURCES + if [ -n "${{join(matrix.source_keys, ' ')}}" ] + then + SOURCE_KEYS=("${{join(matrix.source_keys, '" "')}}") + fi + if [ -n "${{join(matrix.sources, ' ')}}" ] + then + SOURCES=("${{join(matrix.sources, '" "')}}") + fi for key in "${SOURCE_KEYS[@]}" do for i in {1..$NET_RETRY_COUNT} do + echo "Adding key: $key" wget -O - "$key" | sudo apt-key add - && break || sleep 2 done done if [ ${#SOURCES[@]} -gt 0 ] then APT_ADD_REPO_COMMON_ARGS=("-y") - APT_ADD_REPO_HAS_SOURCE_ARGS=0 - SOFTWARE_PROPERTIES_VERSION="$(dpkg-query --showformat='${Version}' --show software-properties-common)" - if dpkg --compare-versions "$SOFTWARE_PROPERTIES_VERSION" ge "0.96.24.20" + APT_ADD_REPO_SUPPORTED_ARGS="$(apt-add-repository --help | perl -ne 'if (/^\s*-n/) { print "n"; } elsif (/^\s*-P/) { print "P"; } elsif (/^\s*-S/) { print "S"; } elsif (/^\s*-U/) { print "U"; }')" + if [ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*n*}" ] then APT_ADD_REPO_COMMON_ARGS+=("-n") fi - if dpkg --compare-versions "$SOFTWARE_PROPERTIES_VERSION" ge "0.98.10" - then - APT_ADD_REPO_HAS_SOURCE_ARGS=1 - fi + APT_ADD_REPO_HAS_SOURCE_ARGS="$([ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*P*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*S*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*U*}" ] && echo 1 || echo 0)" for source in "${SOURCES[@]}" do for i in {1..$NET_RETRY_COUNT} @@ -305,6 +309,7 @@ jobs: esac fi APT_ADD_REPO_ARGS+=("$source") + echo "apt-add-repository ${APT_ADD_REPO_ARGS[@]}" sudo -E apt-add-repository "${APT_ADD_REPO_ARGS[@]}" && break || sleep 2 done done @@ -335,7 +340,7 @@ jobs: REF=${GITHUB_BASE_REF:-$GITHUB_REF} REF=${REF#refs/heads/} echo REF: $REF - BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true echo BOOST_BRANCH: $BOOST_BRANCH BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null) echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV From acf35d2a87338d549f2631033e829b75bf30e1f1 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 19 Nov 2021 18:32:24 +0300 Subject: [PATCH 050/173] Fixed a link to library docs and silenced b2 warning about unescaped character. --- doc/Jamfile.v2 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 27ad9cd2b..c75d268f7 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -4,20 +4,20 @@ using quickbook ; -xml iterator - : - quickbook/iterator.qbk +xml iterator + : + quickbook/iterator.qbk ; boostbook standalone : iterator : - boost.root=../../../.. + "boost.root=../../../.." toc.max.depth=3 toc.section.depth=3 chunk.section.depth=2 - pdf:boost.url.prefix=http://www.boost.org/doc/libs/release/libs/iterator/doc + pdf:"boost.url.prefix=http://www.boost.org/doc/libs/release/libs/iterator/doc/html" ; ############################################################################### From 7a200905ddb38b14afeabc8312d2665052c5c51f Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 13 Jan 2022 16:34:47 +0300 Subject: [PATCH 051/173] Added an assignment operator to counting_iterator. This should silence gcc warnings about deprecated implicit copy assignment operator because of the explicitly defined copy constructor. Also, changed constructor definitions to be defaulted when possible and added missing includes. Closes https://github.com/boostorg/iterator/pull/69. --- include/boost/iterator/counting_iterator.hpp | 24 ++++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/include/boost/iterator/counting_iterator.hpp b/include/boost/iterator/counting_iterator.hpp index 9bb0419d0..89dbe99c9 100644 --- a/include/boost/iterator/counting_iterator.hpp +++ b/include/boost/iterator/counting_iterator.hpp @@ -5,6 +5,16 @@ #ifndef COUNTING_ITERATOR_DWA200348_HPP # define COUNTING_ITERATOR_DWA200348_HPP +# include +# include +# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +# include +# elif !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) +# include +# else +# include +# endif +# include # include # include # include @@ -45,7 +55,7 @@ namespace detail && boost::is_convertible::value )); # else - BOOST_STATIC_CONSTANT(bool, value = ::boost::is_arithmetic::value); + BOOST_STATIC_CONSTANT(bool, value = ::boost::is_arithmetic::value); # endif # endif @@ -77,8 +87,6 @@ namespace detail typedef typename boost::detail::numeric_traits::difference_type type; }; - BOOST_STATIC_ASSERT(is_numeric::value); - template struct counting_iterator_base { @@ -161,9 +169,9 @@ class counting_iterator public: typedef typename super_t::difference_type difference_type; - counting_iterator() { } + BOOST_DEFAULTED_FUNCTION(counting_iterator(), {}) - counting_iterator(counting_iterator const& rhs) : super_t(rhs.base()) {} + BOOST_DEFAULTED_FUNCTION(counting_iterator(counting_iterator const& rhs), : super_t(rhs.base()) {}) counting_iterator(Incrementable x) : super_t(x) @@ -180,6 +188,8 @@ class counting_iterator {} # endif + BOOST_DEFAULTED_FUNCTION(counting_iterator& operator=(counting_iterator const& rhs), { *static_cast< super_t* >(this) = static_cast< super_t const& >(rhs); return *this; }) + private: typename super_t::reference dereference() const @@ -206,8 +216,8 @@ template inline counting_iterator make_counting_iterator(Incrementable x) { - typedef counting_iterator result_t; - return result_t(x); + typedef counting_iterator result_t; + return result_t(x); } } // namespace iterators From abe6fbfd4b8b69c1ac9c7cb43452a2a5f74ec708 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 13 Jan 2022 16:49:28 +0300 Subject: [PATCH 052/173] Converted counting_iterator to rely on TypeTraits instead of MPL. --- include/boost/iterator/counting_iterator.hpp | 43 ++++++++++---------- test/counting_iterator_test.cpp | 4 +- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/include/boost/iterator/counting_iterator.hpp b/include/boost/iterator/counting_iterator.hpp index 89dbe99c9..45d4c839f 100644 --- a/include/boost/iterator/counting_iterator.hpp +++ b/include/boost/iterator/counting_iterator.hpp @@ -15,12 +15,11 @@ # include # endif # include -# include +# include +# include +# include # include -# include -# include -# include -# include +# include namespace boost { namespace iterators { @@ -63,23 +62,23 @@ namespace detail template struct is_numeric - : mpl::bool_<(::boost::iterators::detail::is_numeric_impl::value)> + : boost::integral_constant::value> {}; # if defined(BOOST_HAS_LONG_LONG) template <> struct is_numeric< ::boost::long_long_type> - : mpl::true_ {}; + : boost::true_type {}; template <> struct is_numeric< ::boost::ulong_long_type> - : mpl::true_ {}; + : boost::true_type {}; # endif // Some compilers fail to have a numeric_limits specialization template <> struct is_numeric - : mpl::true_ {}; + : true_type {}; template struct numeric_difference @@ -92,20 +91,20 @@ namespace detail { typedef typename detail::ia_dflt_help< CategoryOrTraversal - , mpl::eval_if< - is_numeric - , mpl::identity + , typename boost::conditional< + is_numeric::value + , boost::type_identity , iterator_traversal - > + >::type >::type traversal; typedef typename detail::ia_dflt_help< Difference - , mpl::eval_if< - is_numeric + , typename boost::conditional< + is_numeric::value , numeric_difference , iterator_difference - > + >::type >::type difference; typedef iterator_adaptor< @@ -201,13 +200,13 @@ class counting_iterator difference_type distance_to(counting_iterator const& y) const { - typedef typename mpl::if_< - detail::is_numeric - , detail::number_distance - , detail::iterator_distance - >::type d; + typedef typename boost::conditional< + detail::is_numeric::value + , detail::number_distance + , detail::iterator_distance + >::type d; - return d::distance(this->base(), y.base()); + return d::distance(this->base(), y.base()); } }; diff --git a/test/counting_iterator_test.cpp b/test/counting_iterator_test.cpp index 0b1db7bff..ac382f0df 100644 --- a/test/counting_iterator_test.cpp +++ b/test/counting_iterator_test.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include @@ -68,7 +68,7 @@ struct unsigned_assert_nonnegative template struct assert_nonnegative - : boost::mpl::if_c< + : boost::conditional< std::numeric_limits::is_signed , signed_assert_nonnegative , unsigned_assert_nonnegative From eb0d01126a573a204c4382cbdde3a0bf8aa1924c Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 13 Jan 2022 16:59:46 +0300 Subject: [PATCH 053/173] Added support for int128 to counting_iterator. --- include/boost/iterator/counting_iterator.hpp | 29 ++++++++++++++++++-- test/counting_iterator_test.cpp | 8 ++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/include/boost/iterator/counting_iterator.hpp b/include/boost/iterator/counting_iterator.hpp index 45d4c839f..65c11e94b 100644 --- a/include/boost/iterator/counting_iterator.hpp +++ b/include/boost/iterator/counting_iterator.hpp @@ -67,11 +67,21 @@ namespace detail # if defined(BOOST_HAS_LONG_LONG) template <> - struct is_numeric< ::boost::long_long_type> + struct is_numeric : boost::true_type {}; template <> - struct is_numeric< ::boost::ulong_long_type> + struct is_numeric + : boost::true_type {}; +# endif + +# if defined(BOOST_HAS_INT128) + template <> + struct is_numeric + : boost::true_type {}; + + template <> + struct is_numeric : boost::true_type {}; # endif @@ -86,6 +96,21 @@ namespace detail typedef typename boost::detail::numeric_traits::difference_type type; }; +# if defined(BOOST_HAS_INT128) + // std::numeric_limits, which is used by numeric_traits, is not specialized for __int128 in some standard libraries + template <> + struct numeric_difference + { + typedef boost::int128_type type; + }; + + template <> + struct numeric_difference + { + typedef boost::int128_type type; + }; +# endif + template struct counting_iterator_base { diff --git a/test/counting_iterator_test.cpp b/test/counting_iterator_test.cpp index ac382f0df..09d4295b5 100644 --- a/test/counting_iterator_test.cpp +++ b/test/counting_iterator_test.cpp @@ -271,8 +271,12 @@ int main() test_integer(); test_integer(); #if defined(BOOST_HAS_LONG_LONG) - test_integer< ::boost::long_long_type>(); - test_integer< ::boost::ulong_long_type>(); + test_integer(); + test_integer(); +#endif +#if defined(BOOST_HAS_INT128) + test_integer(); + test_integer(); #endif // Test user-defined type. From c901bd6d7a8f6fb1cf0d168aaa91adc6475a8808 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 13 Jan 2022 17:08:55 +0300 Subject: [PATCH 054/173] Switched function_input_iterator to TypeTraits instead of MPL. --- .../iterator/function_input_iterator.hpp | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/include/boost/iterator/function_input_iterator.hpp b/include/boost/iterator/function_input_iterator.hpp index caa627295..11f87de6f 100644 --- a/include/boost/iterator/function_input_iterator.hpp +++ b/include/boost/iterator/function_input_iterator.hpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include @@ -38,7 +38,7 @@ namespace iterators { { typedef typename result_of< #ifdef BOOST_RESULT_OF_USE_TR1 - typename mpl::if_, F&, F>::type() + typename boost::conditional::value, F&, F>::type() #else F&() #endif @@ -46,12 +46,12 @@ namespace iterators { }; template - class function_input_iterator - : public iterator_facade< - function_input_iterator, - typename result_of_nullary_lvalue_call::type, - single_pass_traversal_tag, - typename result_of_nullary_lvalue_call::type const & + class function_input_iterator : + public iterator_facade< + function_input_iterator, + typename result_of_nullary_lvalue_call::type, + single_pass_traversal_tag, + typename result_of_nullary_lvalue_call::type const & > { public: @@ -83,12 +83,12 @@ namespace iterators { }; template - class function_pointer_input_iterator - : public iterator_facade< - function_pointer_input_iterator, - typename function_types::result_type::type, - single_pass_traversal_tag, - typename function_types::result_type::type const & + class function_pointer_input_iterator : + public iterator_facade< + function_pointer_input_iterator, + typename function_types::result_type::type, + single_pass_traversal_tag, + typename function_types::result_type::type const & > { public: @@ -122,15 +122,15 @@ namespace iterators { } // namespace impl template - class function_input_iterator - : public mpl::if_< - function_types::is_function_pointer, + class function_input_iterator : + public boost::conditional< + function_types::is_function_pointer::value, impl::function_pointer_input_iterator, impl::function_input_iterator >::type { - typedef typename mpl::if_< - function_types::is_function_pointer, + typedef typename boost::conditional< + function_types::is_function_pointer::value, impl::function_pointer_input_iterator, impl::function_input_iterator >::type base_type; @@ -153,7 +153,8 @@ namespace iterators { return result_t(f, state); } - struct infinite { + struct infinite + { infinite & operator++() { return *this; } infinite & operator++(int) { return *this; } bool operator==(infinite &) const { return false; }; From e4ab917f79089c08cdc5cea193743c43a24f0c13 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 13 Jan 2022 17:22:25 +0300 Subject: [PATCH 055/173] Removed unneeded includes and added missing ones to transform_iterator. --- include/boost/iterator/transform_iterator.hpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/boost/iterator/transform_iterator.hpp b/include/boost/iterator/transform_iterator.hpp index 2281df877..5b2b810e0 100644 --- a/include/boost/iterator/transform_iterator.hpp +++ b/include/boost/iterator/transform_iterator.hpp @@ -7,11 +7,11 @@ #ifndef BOOST_TRANSFORM_ITERATOR_23022003THW_HPP #define BOOST_TRANSFORM_ITERATOR_23022003THW_HPP +#include +#include #include #include #include -#include -#include #include #include #include @@ -24,7 +24,11 @@ #include #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) -# include +#include +#endif + +#if !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) +#include #endif #include @@ -154,7 +158,7 @@ namespace iterators { return transform_iterator(it, UnaryFunc()); } -#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) template inline transform_iterator< Return (*)(Argument), Iterator, Return> make_transform_iterator(Iterator it, Return (*fun)(Argument)) From 75ba1a50c958d8db0b49ceccec922f5dfc64fe2d Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 13 Jan 2022 17:28:53 +0300 Subject: [PATCH 056/173] Switched enable_if from MPL to TypeTraits. --- include/boost/iterator/detail/enable_if.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/boost/iterator/detail/enable_if.hpp b/include/boost/iterator/detail/enable_if.hpp index 071f5fe81..dcc9adb73 100644 --- a/include/boost/iterator/detail/enable_if.hpp +++ b/include/boost/iterator/detail/enable_if.hpp @@ -7,10 +7,11 @@ #ifndef BOOST_ENABLE_IF_23022003THW_HPP #define BOOST_ENABLE_IF_23022003THW_HPP -#include -#include - +#include #include +#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) +#include +#endif // // Boost iterators uses its own enable_if cause we need @@ -48,7 +49,6 @@ namespace boost struct base { #ifdef BOOST_NO_SFINAE - typedef T type; // This way to do it would give a nice error message containing @@ -69,7 +69,7 @@ namespace boost # if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE) : enabled<(Cond::value)>::template base # else - : mpl::identity + : boost::type_identity # endif { }; From d175ba245026adf22d7cea7d992079162f5110ea Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 13 Jan 2022 17:32:11 +0300 Subject: [PATCH 057/173] Trim trailing spaces. --- example/node.hpp | 8 ++++---- example/node_iterator1.hpp | 4 ++-- example/node_iterator2.hpp | 8 ++++---- example/node_iterator3.hpp | 8 ++++---- include/boost/iterator/detail/config_def.hpp | 12 ++++++------ include/boost/iterator/detail/config_undef.hpp | 2 +- include/boost/iterator/new_iterator_tests.hpp | 16 ++++++++-------- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/example/node.hpp b/example/node.hpp index c3ed3152e..de5ec8d16 100644 --- a/example/node.hpp +++ b/example/node.hpp @@ -24,7 +24,7 @@ struct node_base virtual void print(std::ostream& s) const = 0; virtual void double_me() = 0; - + void append(node_base* p) { if (m_next) @@ -32,7 +32,7 @@ struct node_base else m_next = p; } - + private: node_base* m_next; }; @@ -52,9 +52,9 @@ struct node : node_base void print(std::ostream& s) const { s << this->m_value; } void double_me() { m_value += m_value; } - + private: T m_value; }; - + #endif // NODE_DWA2004110_HPP diff --git a/example/node_iterator1.hpp b/example/node_iterator1.hpp index 5e068b4b8..9a1ed51ea 100644 --- a/example/node_iterator1.hpp +++ b/example/node_iterator1.hpp @@ -28,10 +28,10 @@ class node_iterator void increment() { m_node = m_node->next(); } - + bool equal(node_iterator const& other) const { return this->m_node == other.m_node; } - + node_base& dereference() const { return *m_node; } diff --git a/example/node_iterator2.hpp b/example/node_iterator2.hpp index 6aa0a4cd9..1f5d834ab 100644 --- a/example/node_iterator2.hpp +++ b/example/node_iterator2.hpp @@ -38,15 +38,15 @@ class node_iter boost::is_convertible , enabler >::type = enabler() -# endif +# endif ) : m_node(other.m_node) {} # if !BOOST_WORKAROUND(__GNUC__, == 2) - private: // GCC2 can't grant friendship to template member functions + private: // GCC2 can't grant friendship to template member functions friend class boost::iterator_core_access; -# endif +# endif template bool equal(node_iter const& other) const @@ -63,7 +63,7 @@ class node_iter # else private: template friend class node_iter; -# endif +# endif Value* m_node; }; diff --git a/example/node_iterator3.hpp b/example/node_iterator3.hpp index 85127e1c1..3ae7bec5a 100644 --- a/example/node_iterator3.hpp +++ b/example/node_iterator3.hpp @@ -27,7 +27,7 @@ class node_iter typedef boost::iterator_adaptor< node_iter, Value*, boost::use_default, boost::forward_traversal_tag > super_t; - + public: node_iter() : super_t(0) {} @@ -43,14 +43,14 @@ class node_iter boost::is_convertible , enabler >::type = enabler() -# endif +# endif ) : super_t(other.base()) {} # if !BOOST_WORKAROUND(__GNUC__, == 2) - private: // GCC2 can't grant friendship to template member functions + private: // GCC2 can't grant friendship to template member functions friend class boost::iterator_core_access; -# endif +# endif void increment() { this->base_reference() = this->base()->next(); } }; diff --git a/include/boost/iterator/detail/config_def.hpp b/include/boost/iterator/detail/config_def.hpp index 554ae0abd..bd04b75d8 100644 --- a/include/boost/iterator/detail/config_def.hpp +++ b/include/boost/iterator/detail/config_def.hpp @@ -18,9 +18,9 @@ #ifdef BOOST_ITERATOR_CONFIG_DEF # error you have nested config_def #inclusion. -#else +#else # define BOOST_ITERATOR_CONFIG_DEF -#endif +#endif // We enable this always now. Otherwise, the simple case in // libs/iterator/test/constant_iterator_arrow.cpp fails to compile @@ -50,7 +50,7 @@ || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) \ || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) - + # define BOOST_NO_LVALUE_RETURN_DETECTION # if 0 // test code @@ -79,7 +79,7 @@ int z2[(lvalue_deref_helper::value == 1) ? 1 : -1]; int z[(lvalue_deref_helper::value) == 1 ? -1 : 1 ]; -# endif +# endif #endif @@ -112,7 +112,7 @@ #if !defined(BOOST_MSVC) && (defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE)) # define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY -#endif +#endif # if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) @@ -123,6 +123,6 @@ // instantiation stack backtrace. They may be due in part to the fact // that it drops cv-qualification willy-nilly in templates. # define BOOST_NO_ONE_WAY_ITERATOR_INTEROP -# endif +# endif // no include guard; multiple inclusion intended diff --git a/include/boost/iterator/detail/config_undef.hpp b/include/boost/iterator/detail/config_undef.hpp index bf1b8d708..a32529c02 100644 --- a/include/boost/iterator/detail/config_undef.hpp +++ b/include/boost/iterator/detail/config_undef.hpp @@ -21,4 +21,4 @@ # undef BOOST_ITERATOR_CONFIG_DEF #else # error missing or nested #include config_def -#endif +#endif diff --git a/include/boost/iterator/new_iterator_tests.hpp b/include/boost/iterator/new_iterator_tests.hpp index a1d3b2fbf..2091e5976 100644 --- a/include/boost/iterator/new_iterator_tests.hpp +++ b/include/boost/iterator/new_iterator_tests.hpp @@ -87,11 +87,11 @@ void readable_iterator_test(const Iterator i1, T v) # if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) readable_iterator_traversal_test(i1, v, detail::is_postfix_incrementable()); - + // I think we don't really need this as it checks the same things as // the above code. BOOST_STATIC_ASSERT(is_readable_iterator::value); -# endif +# endif } template @@ -106,7 +106,7 @@ void writable_iterator_test(Iterator i, T v, T v2) detail::is_incrementable , detail::is_postfix_incrementable >()); -# endif +# endif } template @@ -131,7 +131,7 @@ void constant_lvalue_iterator_test(Iterator i, T v1) # ifndef BOOST_NO_LVALUE_RETURN_DETECTION BOOST_STATIC_ASSERT(is_lvalue_iterator::value); BOOST_STATIC_ASSERT(!is_non_const_lvalue_iterator::value); -# endif +# endif } template @@ -143,17 +143,17 @@ void non_const_lvalue_iterator_test(Iterator i, T v1, T v2) BOOST_STATIC_ASSERT((is_same::value)); T& v3 = *i2; BOOST_TEST(v1 == v3); - + // A non-const lvalue iterator is not neccessarily writable, but we // are assuming the value_type is assignable here *i = v2; - + T& v4 = *i2; BOOST_TEST(v2 == v4); # ifndef BOOST_NO_LVALUE_RETURN_DETECTION BOOST_STATIC_ASSERT(is_lvalue_iterator::value); BOOST_STATIC_ASSERT(is_non_const_lvalue_iterator::value); -# endif +# endif } template @@ -248,7 +248,7 @@ void random_access_readable_iterator_test(Iterator i, int N, TrueVals vals) BOOST_TEST(*i == vals[N - 1 - c]); typename std::iterator_traits::value_type x = j[N - 1 - c]; BOOST_TEST(*i == x); - Iterator q = k - c; + Iterator q = k - c; BOOST_TEST(*i == *q); BOOST_TEST(i > j); BOOST_TEST(i >= j); From 85d935bf6869522bd96880195bde60a185315040 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 6 Jun 2022 02:57:44 +0300 Subject: [PATCH 058/173] Added VS2022 job and C++20 and C++latest jobs to AppVeyor CI. --- appveyor.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4483bcec0..8cf1ba5f6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,19 +22,24 @@ environment: ADDRMD: 32,64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: msvc-14.0 + CXXSTD: 14,latest ADDRMD: 32,64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: msvc-14.1 - CXXSTD: 14,17 + CXXSTD: 14,17,latest ADDRMD: 32,64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - TOOLSET: msvc-14.2 ADDRMD: 32,64 - CXXSTD: 14,17 + CXXSTD: 14,17,20,latest APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + - TOOLSET: msvc-14.3 + ADDRMD: 32,64 + CXXSTD: 14,17,20,latest + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - TOOLSET: clang-win ADDRMD: 32,64 - CXXSTD: 14,17 + CXXSTD: 14,17,latest APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - TOOLSET: gcc CXXSTD: 03,11,14,1z From c924b4274949bda0283231d0039dd582d0bcd4b0 Mon Sep 17 00:00:00 2001 From: jakob lovhall Date: Thu, 30 Jun 2022 15:35:25 +0200 Subject: [PATCH 059/173] add forward reference assignment operator to function_output_iterator --- .../boost/iterator/function_output_iterator.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/boost/iterator/function_output_iterator.hpp b/include/boost/iterator/function_output_iterator.hpp index 51fe83508..80c29c756 100644 --- a/include/boost/iterator/function_output_iterator.hpp +++ b/include/boost/iterator/function_output_iterator.hpp @@ -12,6 +12,11 @@ #define BOOST_ITERATOR_FUNCTION_OUTPUT_ITERATOR_HPP #include +#include + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +#include +#endif namespace boost { namespace iterators { @@ -33,10 +38,19 @@ namespace iterators { struct output_proxy { output_proxy(UnaryFunction& f) : m_f(f) { } + +#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES template output_proxy& operator=(const T& value) { m_f(value); return *this; } +#else + template output_proxy& operator=(T&& value) { + m_f(std::forward(value)); + return *this; + } +#endif + UnaryFunction& m_f; }; output_proxy operator*() { return output_proxy(m_f); } From dd37a27067a5deaecd30a73a5ec255c3d2f0500c Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 30 Jun 2022 23:25:33 +0300 Subject: [PATCH 060/173] Marked output_proxy constructor explicit. --- include/boost/iterator/function_output_iterator.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/iterator/function_output_iterator.hpp b/include/boost/iterator/function_output_iterator.hpp index 80c29c756..a0b157356 100644 --- a/include/boost/iterator/function_output_iterator.hpp +++ b/include/boost/iterator/function_output_iterator.hpp @@ -37,7 +37,7 @@ namespace iterators { : m_f(f) {} struct output_proxy { - output_proxy(UnaryFunction& f) : m_f(f) { } + explicit output_proxy(UnaryFunction& f) : m_f(f) { } #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES template output_proxy& operator=(const T& value) { From cd244871618541cd8844dc766b8ff566932194b0 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 30 Jun 2022 23:26:52 +0300 Subject: [PATCH 061/173] Removed #include . --- include/boost/iterator/function_output_iterator.hpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/include/boost/iterator/function_output_iterator.hpp b/include/boost/iterator/function_output_iterator.hpp index a0b157356..ec72338bb 100644 --- a/include/boost/iterator/function_output_iterator.hpp +++ b/include/boost/iterator/function_output_iterator.hpp @@ -14,10 +14,6 @@ #include #include -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -#include -#endif - namespace boost { namespace iterators { @@ -46,7 +42,7 @@ namespace iterators { } #else template output_proxy& operator=(T&& value) { - m_f(std::forward(value)); + m_f(static_cast< T&& >(value)); return *this; } #endif From ee2d3a65969b8e6b9fc49cb00d76746bfee81ed1 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 30 Jun 2022 23:35:58 +0300 Subject: [PATCH 062/173] Made output_proxy private and made its internals private. --- .../iterator/function_output_iterator.hpp | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/include/boost/iterator/function_output_iterator.hpp b/include/boost/iterator/function_output_iterator.hpp index ec72338bb..2708bbd07 100644 --- a/include/boost/iterator/function_output_iterator.hpp +++ b/include/boost/iterator/function_output_iterator.hpp @@ -19,20 +19,11 @@ namespace iterators { template class function_output_iterator { + private: typedef function_output_iterator self; - public: - typedef std::output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - explicit function_output_iterator() {} - - explicit function_output_iterator(const UnaryFunction& f) - : m_f(f) {} - - struct output_proxy { + class output_proxy { + public: explicit output_proxy(UnaryFunction& f) : m_f(f) { } #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES @@ -47,11 +38,26 @@ namespace iterators { } #endif + private: UnaryFunction& m_f; }; + + public: + typedef std::output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + explicit function_output_iterator() {} + + explicit function_output_iterator(const UnaryFunction& f) + : m_f(f) {} + output_proxy operator*() { return output_proxy(m_f); } self& operator++() { return *this; } self& operator++(int) { return *this; } + private: UnaryFunction m_f; }; From 1a80896934581d3af85c87d146ca89a776c0ca3a Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 1 Jul 2022 00:13:32 +0300 Subject: [PATCH 063/173] Disabled assignment of output_proxy to output_proxy. --- .../iterator/function_output_iterator.hpp | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/include/boost/iterator/function_output_iterator.hpp b/include/boost/iterator/function_output_iterator.hpp index 2708bbd07..72a864d40 100644 --- a/include/boost/iterator/function_output_iterator.hpp +++ b/include/boost/iterator/function_output_iterator.hpp @@ -13,6 +13,10 @@ #include #include +#include +#include +#include +#include namespace boost { namespace iterators { @@ -24,20 +28,31 @@ namespace iterators { class output_proxy { public: - explicit output_proxy(UnaryFunction& f) : m_f(f) { } + explicit output_proxy(UnaryFunction& f) BOOST_NOEXCEPT : m_f(f) { } #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES - template output_proxy& operator=(const T& value) { + template + typename boost::disable_if_c< + boost::is_same< typename boost::remove_cv< T >::type, output_proxy >::value, + output_proxy& + >::type operator=(const T& value) { m_f(value); return *this; } #else - template output_proxy& operator=(T&& value) { + template + typename boost::disable_if_c< + boost::is_same< typename boost::remove_cv< typename boost::remove_reference< T >::type >::type, output_proxy >::value, + output_proxy& + >::type operator=(T&& value) { m_f(static_cast< T&& >(value)); return *this; } #endif + BOOST_DEFAULTED_FUNCTION(output_proxy(output_proxy const& that), BOOST_NOEXCEPT : m_f(that.m_f) {}) + BOOST_DELETED_FUNCTION(output_proxy& operator=(output_proxy const&)) + private: UnaryFunction& m_f; }; From 129245a9852b12dd1c822f9b073ea4c47f57a854 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 1 Jul 2022 00:14:14 +0300 Subject: [PATCH 064/173] Added tests for function_output_iterator. --- test/Jamfile.v2 | 2 + test/function_output_iterator_cf.cpp | 37 ++++++++++++++++ test/function_output_iterator_test.cpp | 61 ++++++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 test/function_output_iterator_cf.cpp create mode 100644 test/function_output_iterator_test.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 14b7b2a0c..96e440bdf 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -50,6 +50,8 @@ test-suite iterator [ run permutation_iterator_test.cpp : : : # on ] [ run function_input_iterator_test.cpp ] + [ run function_output_iterator_test.cpp ] + [ compile-fail function_output_iterator_cf.cpp ] [ run generator_iterator_test.cpp ] diff --git a/test/function_output_iterator_cf.cpp b/test/function_output_iterator_cf.cpp new file mode 100644 index 000000000..a3f1d9cfc --- /dev/null +++ b/test/function_output_iterator_cf.cpp @@ -0,0 +1,37 @@ +// Copyright 2022 (c) Andrey Semashev +// Distributed under the Boost Software License Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +namespace { + +struct sum_func +{ + typedef void result_type; + + explicit sum_func(int& n) : m_n(n) {} + result_type operator() (int x) const + { + m_n += x; + } + +private: + int& m_n; +}; + +} // namespace + +int main() +{ + int n = 0; + boost::iterators::function_output_iterator< sum_func > it1 = + boost::iterators::make_function_output_iterator(sum_func(n)); + boost::iterators::function_output_iterator< sum_func > it2 = + boost::iterators::make_function_output_iterator(sum_func(n)); + + *it1 = *it2; + + return 0; +} diff --git a/test/function_output_iterator_test.cpp b/test/function_output_iterator_test.cpp new file mode 100644 index 000000000..953a44340 --- /dev/null +++ b/test/function_output_iterator_test.cpp @@ -0,0 +1,61 @@ +// Copyright 2022 (c) Andrey Semashev +// Distributed under the Boost Software License Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include + +#include +#include + +namespace { + +struct sum_func +{ + typedef void result_type; + + explicit sum_func(int& n) : m_n(n) {} + result_type operator() (int x) const + { + m_n += x; + } + +private: + int& m_n; +}; + +} // namespace + +int main() +{ + { + int n = 0; + boost::iterators::function_output_iterator< sum_func > it = + boost::iterators::make_function_output_iterator(sum_func(n)); + + *it = 1; + ++it; + *it = 2; + ++it; + *it = 3; + + BOOST_TEST_EQ(n, 6); + } + +#if !defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) + { + int n = 0; + auto it = boost::iterators::make_function_output_iterator([&n](int x) { n -= x; }); + + *it = 1; + ++it; + *it = 2; + ++it; + *it = 3; + + BOOST_TEST_EQ(n, -6); + } +#endif + + return boost::report_errors(); +} From a3269e536f117559732d5384db54595c1bc8ebca Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 1 Jul 2022 00:23:19 +0300 Subject: [PATCH 065/173] Include remove_reference.hpp only when needed. --- include/boost/iterator/function_output_iterator.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/boost/iterator/function_output_iterator.hpp b/include/boost/iterator/function_output_iterator.hpp index 72a864d40..b59cbc914 100644 --- a/include/boost/iterator/function_output_iterator.hpp +++ b/include/boost/iterator/function_output_iterator.hpp @@ -16,7 +16,9 @@ #include #include #include +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES #include +#endif namespace boost { namespace iterators { From 2cc45f16947c15f335732e3d44b257d876c89a44 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 12 Aug 2022 15:59:54 +0300 Subject: [PATCH 066/173] Switch to macos-11 GHA image as macos-10.15 is deprecated. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bc07f6d6..9006a0ee9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -233,7 +233,7 @@ jobs: - toolset: clang cxxstd: "03,11,14,17,2a" - os: macos-10.15 + os: macos-11 timeout-minutes: 60 runs-on: ${{matrix.os}} From 9504b3bcedc3e3b3d6c84b913f28b01d6c6dc240 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 14 Aug 2022 14:00:17 +0300 Subject: [PATCH 067/173] Replaced ubuntu-18.04 GHA CI images with containers. Also use ubuntu-latest image for jobs that are running in a container. --- .github/workflows/ci.yml | 51 ++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9006a0ee9..d111ec455 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: # Linux, gcc - toolset: gcc-4.4 cxxstd: "98,0x" - os: ubuntu-20.04 + os: ubuntu-latest container: ubuntu:16.04 install: - g++-4.4 @@ -43,7 +43,7 @@ jobs: - "ppa:ubuntu-toolchain-r/test" - toolset: gcc-4.6 cxxstd: "03,0x" - os: ubuntu-20.04 + os: ubuntu-latest container: ubuntu:16.04 install: - g++-4.6 @@ -51,45 +51,50 @@ jobs: - "ppa:ubuntu-toolchain-r/test" - toolset: gcc-4.7 cxxstd: "03,11" - os: ubuntu-20.04 + os: ubuntu-latest container: ubuntu:16.04 install: - g++-4.7 - toolset: gcc-4.8 cxxstd: "03,11" - os: ubuntu-18.04 + os: ubuntu-latest + container: ubuntu:18.04 install: - g++-4.8 - toolset: gcc-4.9 cxxstd: "03,11" - os: ubuntu-20.04 + os: ubuntu-latest container: ubuntu:16.04 install: - g++-4.9 - toolset: gcc-5 cxxstd: "03,11,14,1z" - os: ubuntu-20.04 + os: ubuntu-latest container: ubuntu:16.04 install: - g++-5 - toolset: gcc-6 cxxstd: "03,11,14,1z" - os: ubuntu-18.04 + os: ubuntu-latest + container: ubuntu:18.04 install: - g++-6 - toolset: gcc-7 cxxstd: "03,11,14,17" - os: ubuntu-18.04 + os: ubuntu-latest + container: ubuntu:18.04 install: - g++-7 - toolset: gcc-8 cxxstd: "03,11,14,17,2a" - os: ubuntu-18.04 + os: ubuntu-latest + container: ubuntu:18.04 install: - g++-8 - toolset: gcc-9 cxxstd: "03,11,14,17,2a" - os: ubuntu-18.04 + os: ubuntu-latest + container: ubuntu:18.04 install: - g++-9 - toolset: gcc-10 @@ -119,66 +124,72 @@ jobs: - toolset: clang compiler: clang++-3.5 cxxstd: "03,11" - os: ubuntu-20.04 + os: ubuntu-latest container: ubuntu:16.04 install: - clang-3.5 - toolset: clang compiler: clang++-3.6 cxxstd: "03,11,14" - os: ubuntu-20.04 + os: ubuntu-latest container: ubuntu:16.04 install: - clang-3.6 - toolset: clang compiler: clang++-3.7 cxxstd: "03,11,14" - os: ubuntu-20.04 + os: ubuntu-latest container: ubuntu:16.04 install: - clang-3.7 - toolset: clang compiler: clang++-3.8 cxxstd: "03,11,14" - os: ubuntu-20.04 + os: ubuntu-latest container: ubuntu:16.04 install: - clang-3.8 - toolset: clang compiler: clang++-3.9 cxxstd: "03,11,14" - os: ubuntu-18.04 + os: ubuntu-latest + container: ubuntu:18.04 install: - clang-3.9 - toolset: clang compiler: clang++-4.0 cxxstd: "03,11,14" - os: ubuntu-18.04 + os: ubuntu-latest + container: ubuntu:18.04 install: - clang-4.0 - toolset: clang compiler: clang++-5.0 cxxstd: "03,11,14,1z" - os: ubuntu-18.04 + os: ubuntu-latest + container: ubuntu:18.04 install: - clang-5.0 - toolset: clang compiler: clang++-6.0 cxxstd: "03,11,14,17" - os: ubuntu-18.04 + os: ubuntu-latest + container: ubuntu:18.04 install: - clang-6.0 - toolset: clang compiler: clang++-7 cxxstd: "03,11,14,17" - os: ubuntu-18.04 + os: ubuntu-latest + container: ubuntu:18.04 install: - clang-7 # Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode - toolset: clang compiler: clang++-8 cxxstd: "03,11,14,17,2a" - os: ubuntu-18.04 + os: ubuntu-latest + container: ubuntu:18.04 install: - clang-8 - g++-7 From 17355c5ad02b53e8d529a86559fbb82d941878b3 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 14 Aug 2022 14:01:45 +0300 Subject: [PATCH 068/173] Updated copyright years. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d111ec455..5c558251e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -# Copyright 2021 Andrey Semashev +# Copyright 2021-2022 Andrey Semashev # # 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) From ce52aee3ceaf4e37d171fb811000f28bb80f91cd Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 14 Aug 2022 17:53:43 +0300 Subject: [PATCH 069/173] Switched gcc-9 to ubuntu-20.04 GHA CI image. --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c558251e..0687ea3c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,8 +93,7 @@ jobs: - g++-8 - toolset: gcc-9 cxxstd: "03,11,14,17,2a" - os: ubuntu-latest - container: ubuntu:18.04 + os: ubuntu-20.04 install: - g++-9 - toolset: gcc-10 From ed1d96f25163386623fda44f4451a28e49df386f Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 10 Sep 2022 01:29:45 +0300 Subject: [PATCH 070/173] GitHub Actions config update. - Added gcc-12 and clang-13 through 15 jobs. - Added C++23 testing for gcc and clang on Linux. - Updated clang version for UBSAN job. - Updated Ubuntu version for clang jobs to avoid having to use external APT repository. - Updated python package installation for compatibility with Ubuntu 22.04. --- .github/workflows/ci.yml | 81 ++++++++++++++++++++++++++++------------ 1 file changed, 57 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0687ea3c1..d8f5c6755 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,22 +102,23 @@ jobs: install: - g++-10 - toolset: gcc-11 - cxxstd: "03,11,14,17,20" - os: ubuntu-20.04 + cxxstd: "03,11,14,17,20,23" + os: ubuntu-22.04 install: - g++-11 - sources: - - "ppa:ubuntu-toolchain-r/test" + - toolset: gcc-12 + cxxstd: "03,11,14,17,20,23" + os: ubuntu-22.04 + install: + - g++-12 - name: UBSAN toolset: gcc-11 - cxxstd: "03,11,14,17,20" + cxxstd: "03,11,14,17,20,23" ubsan: 1 build_variant: debug - os: ubuntu-20.04 + os: ubuntu-22.04 install: - g++-11 - sources: - - "ppa:ubuntu-toolchain-r/test" # Linux, clang - toolset: clang @@ -208,38 +209,64 @@ jobs: - toolset: clang compiler: clang++-11 cxxstd: "03,11,14,17,20" - os: ubuntu-20.04 + os: ubuntu-22.04 install: - clang-11 - toolset: clang compiler: clang++-12 - cxxstd: "03,11,14,17,20" - os: ubuntu-20.04 + cxxstd: "03,11,14,17,20,2b" + os: ubuntu-22.04 install: - clang-12 - toolset: clang - compiler: clang++-12 - cxxstd: "03,11,14,17,20" - os: ubuntu-20.04 + compiler: clang++-13 + cxxstd: "03,11,14,17,20,2b" + os: ubuntu-22.04 install: - - clang-12 - - libc++-12-dev - - libc++abi-12-dev + - clang-13 + - toolset: clang + compiler: clang++-14 + cxxstd: "03,11,14,17,20,2b" + os: ubuntu-22.04 + install: + - clang-14 + - toolset: clang + compiler: clang++-15 + cxxstd: "03,11,14,17,20,2b" + os: ubuntu-22.04 + install: + - clang-15 + sources: + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" + source_keys: + - "https://apt.llvm.org/llvm-snapshot.gpg.key" + - toolset: clang + compiler: clang++-15 + cxxstd: "03,11,14,17,20,2b" + os: ubuntu-22.04 + install: + - clang-15 + - libc++-15-dev + - libc++abi-15-dev + sources: + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" + source_keys: + - "https://apt.llvm.org/llvm-snapshot.gpg.key" cxxflags: -stdlib=libc++ linkflags: -stdlib=libc++ - name: UBSAN toolset: clang - compiler: clang++-12 - cxxstd: "03,11,14,17,20" + compiler: clang++-14 + cxxstd: "03,11,14,17,20,2b" cxxflags: -stdlib=libc++ linkflags: -stdlib=libc++ ubsan: 1 build_variant: debug - os: ubuntu-20.04 + os: ubuntu-22.04 install: - - clang-12 - - libc++-12-dev - - libc++abi-12-dev + - clang-14 + - libc++-14-dev + - libc++abi-14-dev - toolset: clang cxxstd: "03,11,14,17,2a" @@ -263,7 +290,13 @@ jobs: if [ -f "/etc/debian_version" ] then apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ python python3 perl git cmake + if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ] + then + PYTHON_PACKAGE="python-is-python3" + else + PYTHON_PACKAGE="python" + fi + apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ $PYTHON_PACKAGE python3 perl git cmake fi fi git config --global pack.threads 0 From f82627f2cc5313a53da75cd52662e76eef6435ab Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 18 Oct 2022 17:57:57 +0300 Subject: [PATCH 071/173] Updated to GHA checkout@v3 to avoid deprecation warnings. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8f5c6755..a1f40f65a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -301,7 +301,7 @@ jobs: fi git config --global pack.threads 0 - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install packages if: matrix.install From 853ba3d3c773d75bf2ac7c100c9ef44821f76d8b Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 9 Nov 2022 19:17:26 +0300 Subject: [PATCH 072/173] Use the proper derived type of the function_input_iterator in iterator_facade. This fixes incorrect final iterator type being used in iterator_facade, which results in an internal base class being returned from various facade methods. Reported in https://github.com/boostorg/iterator/issues/75. --- .../iterator/function_input_iterator.hpp | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/include/boost/iterator/function_input_iterator.hpp b/include/boost/iterator/function_input_iterator.hpp index 11f87de6f..610c1338f 100644 --- a/include/boost/iterator/function_input_iterator.hpp +++ b/include/boost/iterator/function_input_iterator.hpp @@ -28,6 +28,9 @@ namespace boost { namespace iterators { + template + class function_input_iterator; + namespace impl { // Computes the return type of an lvalue-call with an empty argument, @@ -46,21 +49,21 @@ namespace iterators { }; template - class function_input_iterator : + class function_object_input_iterator : public iterator_facade< - function_input_iterator, + iterators::function_input_iterator, typename result_of_nullary_lvalue_call::type, single_pass_traversal_tag, typename result_of_nullary_lvalue_call::type const & > { public: - function_input_iterator() {} - function_input_iterator(Function & f_, Input state_ = Input()) + function_object_input_iterator() {} + function_object_input_iterator(Function & f_, Input state_ = Input()) : f(boost::addressof(f_)), state(state_) {} void increment() { - if(value) + if (value) value = none; else (*f)(); @@ -69,10 +72,12 @@ namespace iterators { typename result_of_nullary_lvalue_call::type const & dereference() const { - return (value ? value : value = (*f)()).get(); + if (!value) + value = (*f)(); + return value.get(); } - bool equal(function_input_iterator const & other) const { + bool equal(function_object_input_iterator const & other) const { return f == other.f && state == other.state; } @@ -85,7 +90,7 @@ namespace iterators { template class function_pointer_input_iterator : public iterator_facade< - function_pointer_input_iterator, + iterators::function_input_iterator, typename function_types::result_type::type, single_pass_traversal_tag, typename function_types::result_type::type const & @@ -97,7 +102,7 @@ namespace iterators { : f(f_), state(state_) {} void increment() { - if(value) + if (value) value = none; else (*f)(); @@ -106,7 +111,9 @@ namespace iterators { typename function_types::result_type::type const & dereference() const { - return (value ? value : value = (*f)()).get(); + if (!value) + value = (*f)(); + return value.get(); } bool equal(function_pointer_input_iterator const & other) const { @@ -126,13 +133,13 @@ namespace iterators { public boost::conditional< function_types::is_function_pointer::value, impl::function_pointer_input_iterator, - impl::function_input_iterator + impl::function_object_input_iterator >::type { typedef typename boost::conditional< function_types::is_function_pointer::value, impl::function_pointer_input_iterator, - impl::function_input_iterator + impl::function_object_input_iterator >::type base_type; public: function_input_iterator(Function & f, Input i) From 5777e9944bf275e7e19e72e88819ec06fea670c3 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 9 Nov 2022 21:06:41 +0300 Subject: [PATCH 073/173] Added conversion from postfix increment proxy to iterator type. This allows expressions such as `Iterator it2(it1++)` to compile. Additionally separated operations that are allowed on the result of dereferencing the proxy to a separate set of proxies to make the allowed set of expressions more strict and unambiguous. In particular, it means `it++` cannot be converted to value type and `*it++` cannot be converted to the iterator type anymore. Also, make sure `*it1++ = *it2++` works as expexted by explicitly converting the proxy to the value type on assignment. Fixes https://github.com/boostorg/iterator/issues/75. --- include/boost/iterator/iterator_facade.hpp | 152 +++++++++++++++++---- 1 file changed, 124 insertions(+), 28 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index b43e618f0..20cde3dc2 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -150,83 +150,179 @@ namespace iterators { // value must be read and stored away before the increment occurs // so that *a++ yields the originally referenced element and not // the next one. - template - class postfix_increment_proxy + template + class postfix_increment_dereference_proxy { - typedef typename iterator_value::type value_type; + typedef Value value_type; public: - explicit postfix_increment_proxy(Iterator const& x) - : stored_value(*x) +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template + explicit postfix_increment_dereference_proxy(OtherValue&& x) + : stored_value(static_cast< OtherValue&& >(x)) + {} +#else + explicit postfix_increment_dereference_proxy(value_type const& x) + : stored_value(x) {} + explicit postfix_increment_dereference_proxy(value_type& x) + : stored_value(x) + {} +#endif + // Returning a mutable reference allows nonsense like // (*r++).mutate(), but it imposes fewer assumptions about the // behavior of the value_type. In particular, recall that // (*r).mutate() is legal if operator* returns by value. - value_type& - operator*() const + // Provides readability of *r++ + operator value_type&() const { return this->stored_value; } + private: mutable value_type stored_value; }; + template + class postfix_increment_proxy + { + typedef typename iterator_value::type value_type; + public: + explicit postfix_increment_proxy(Iterator const& x) + : stored_iterator(x) + , dereference_proxy(*x) + {} + + postfix_increment_dereference_proxy const& + operator*() const + { + return dereference_proxy; + } + + // Provides X(r++) + operator Iterator const&() const + { + return stored_iterator; + } + + private: + Iterator stored_iterator; + postfix_increment_dereference_proxy dereference_proxy; + }; + + + template + class writable_postfix_increment_dereference_proxy; + + template + struct is_not_writable_postfix_increment_dereference_proxy : + public boost::true_type + {}; + + template + struct is_not_writable_postfix_increment_dereference_proxy< + writable_postfix_increment_dereference_proxy + > : + public boost::false_type + {}; + + template + class writable_postfix_increment_proxy; + // // In general, we can't determine that such an iterator isn't // writable -- we also need to store a copy of the old iterator so // that it can be written into. template - class writable_postfix_increment_proxy + class writable_postfix_increment_dereference_proxy { + friend class writable_postfix_increment_proxy; + typedef typename iterator_value::type value_type; + public: - explicit writable_postfix_increment_proxy(Iterator const& x) - : stored_value(*x) - , stored_iterator(x) + explicit writable_postfix_increment_dereference_proxy(Iterator const& x) + : stored_iterator(x) + , stored_value(*x) {} - // Dereferencing must return a proxy so that both *r++ = o and - // value_type(*r++) can work. In this case, *r is the same as - // *r++, and the conversion operator below is used to ensure - // readability. - writable_postfix_increment_proxy const& - operator*() const + // Provides readability of *r++ + operator value_type&() const { - return *this; + return this->stored_value; } - // Provides readability of *r++ - operator value_type&() const + template + writable_postfix_increment_dereference_proxy const& + operator=(writable_postfix_increment_dereference_proxy const& x) const { - return stored_value; + typedef typename iterator_value::type other_value_type; + *this->stored_iterator = static_cast(x); + return *this; } // Provides writability of *r++ +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template - T const& operator=(T const& x) const + typename iterators::enable_if< + is_not_writable_postfix_increment_dereference_proxy< T >, + writable_postfix_increment_dereference_proxy const& + >::type operator=(T&& x) const + { + *this->stored_iterator = static_cast< T&& >(x); + return *this; + } +#else + template + typename iterators::enable_if< + is_not_writable_postfix_increment_dereference_proxy< T >, + writable_postfix_increment_dereference_proxy const& + >::type operator=(T const& x) const { *this->stored_iterator = x; - return x; + return *this; } // This overload just in case only non-const objects are writable template - T& operator=(T& x) const + typename iterators::enable_if< + is_not_writable_postfix_increment_dereference_proxy< T >, + writable_postfix_increment_dereference_proxy const& + >::type operator=(T& x) const { *this->stored_iterator = x; - return x; + return *this; + } +#endif + + private: + Iterator stored_iterator; + mutable value_type stored_value; + }; + + template + class writable_postfix_increment_proxy + { + public: + explicit writable_postfix_increment_proxy(Iterator const& x) + : dereference_proxy(x) + {} + + writable_postfix_increment_dereference_proxy const& + operator*() const + { + return dereference_proxy; } // Provides X(r++) operator Iterator const&() const { - return stored_iterator; + return dereference_proxy.stored_iterator; } private: - mutable value_type stored_value; - Iterator stored_iterator; + writable_postfix_increment_dereference_proxy dereference_proxy; }; # ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION From 0a95636faf6c4843348a99dc3a87ab22f4be51be Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 9 Nov 2022 21:19:00 +0300 Subject: [PATCH 074/173] Added test for converting func_input_iter increment results to the iterator type. --- test/function_input_iterator_test.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/function_input_iterator_test.cpp b/test/function_input_iterator_test.cpp index 4843f0152..f64e9f59d 100644 --- a/test/function_input_iterator_test.cpp +++ b/test/function_input_iterator_test.cpp @@ -99,6 +99,15 @@ int main() for(std::size_t i = 0; i != 10; ++i) BOOST_TEST_EQ(generated[i], static_cast(42 + i)); + // Test that incrementing the iterator returns a reference to the iterator type + { + typedef boost::iterators::function_input_iterator function_counter_iterator_t; + function_counter_iterator_t it1(counter_generator, 0); + function_counter_iterator_t it2(++it1); + function_counter_iterator_t it3(it2++); + BOOST_TEST_EQ(*it3, 54); + } + #if !defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \ && defined(BOOST_RESULT_OF_USE_DECLTYPE) // test the iterator with lambda expressions From 7c9b4296a189f71b28de3aad025b08da1f4ca84b Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 18 Nov 2022 00:39:26 +0300 Subject: [PATCH 075/173] Fixed accessing members of the dereferenced value after iterator post-increment. The recent commit 5777e9944bf275e7e19e72e88819ec06fea670c3 broke code such as (*it++).foo(), where the result of dereferencing would be convertible to the value type but did not provide the members of the value type. To mitigate this, return a reference to the value instead of a proxy object. This will only work for non-writable iterators (and it didn't work for writable iterators before either) because in that case a proxy is needed to be able to intercept operator=. Also fix a similar issue with (it++)->foo() by adding operator-> overloads to the post-increment result proxies. Added tests for the fixes. --- include/boost/iterator/iterator_facade.hpp | 63 +++++++++------------- test/iterator_facade.cpp | 47 ++++++++++++++-- 2 files changed, 66 insertions(+), 44 deletions(-) diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 20cde3dc2..c4b5ae4c1 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -150,54 +150,25 @@ namespace iterators { // value must be read and stored away before the increment occurs // so that *a++ yields the originally referenced element and not // the next one. - template - class postfix_increment_dereference_proxy - { - typedef Value value_type; - public: -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - template - explicit postfix_increment_dereference_proxy(OtherValue&& x) - : stored_value(static_cast< OtherValue&& >(x)) - {} -#else - explicit postfix_increment_dereference_proxy(value_type const& x) - : stored_value(x) - {} - - explicit postfix_increment_dereference_proxy(value_type& x) - : stored_value(x) - {} -#endif - - // Returning a mutable reference allows nonsense like - // (*r++).mutate(), but it imposes fewer assumptions about the - // behavior of the value_type. In particular, recall that - // (*r).mutate() is legal if operator* returns by value. - // Provides readability of *r++ - operator value_type&() const - { - return this->stored_value; - } - - private: - mutable value_type stored_value; - }; - template class postfix_increment_proxy { typedef typename iterator_value::type value_type; + public: explicit postfix_increment_proxy(Iterator const& x) : stored_iterator(x) - , dereference_proxy(*x) + , stored_value(*x) {} - postfix_increment_dereference_proxy const& - operator*() const + // Returning a mutable reference allows nonsense like + // (*r++).mutate(), but it imposes fewer assumptions about the + // behavior of the value_type. In particular, recall that + // (*r).mutate() is legal if operator* returns by value. + // Provides readability of *r++ + value_type& operator*() const { - return dereference_proxy; + return stored_value; } // Provides X(r++) @@ -206,9 +177,15 @@ namespace iterators { return stored_iterator; } + // Provides (r++)->foo() + value_type* operator->() const + { + return boost::addressof(stored_value); + } + private: Iterator stored_iterator; - postfix_increment_dereference_proxy dereference_proxy; + mutable value_type stored_value; }; @@ -304,6 +281,8 @@ namespace iterators { template class writable_postfix_increment_proxy { + typedef typename iterator_value::type value_type; + public: explicit writable_postfix_increment_proxy(Iterator const& x) : dereference_proxy(x) @@ -321,6 +300,12 @@ namespace iterators { return dereference_proxy.stored_iterator; } + // Provides (r++)->foo() + value_type* operator->() const + { + return boost::addressof(dereference_proxy.stored_value); + } + private: writable_postfix_increment_dereference_proxy dereference_proxy; }; diff --git a/test/iterator_facade.cpp b/test/iterator_facade.cpp index d9e5eb6ee..33e678add 100644 --- a/test/iterator_facade.cpp +++ b/test/iterator_facade.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include // This is a really, really limited test so far. All we're doing // right now is checking that the postfix++ proxy for single-pass @@ -63,7 +63,23 @@ struct proxy struct value { - void mutator() {} // non-const member function + int increment_count; + int private_mutator_count; + int& shared_mutator_count; + + explicit value(int& shared_mutator_count) : + increment_count(0), + private_mutator_count(0), + shared_mutator_count(shared_mutator_count) + { + } + + // non-const member function + void mutator() + { + ++private_mutator_count; + ++shared_mutator_count; + } }; struct input_iter @@ -75,21 +91,25 @@ struct input_iter > { public: - input_iter() {} + explicit input_iter(value& val) : state(&val) {} void increment() { + ++(state->increment_count); } value dereference() const { - return value(); + return *state; } bool equal(input_iter const&) const { return false; } + + private: + value* state; }; template @@ -198,13 +218,30 @@ int main() { // test for a fix to http://tinyurl.com/zuohe // These two lines should be equivalent (and both compile) - input_iter p; + int shared_mutator_count = 0; + value val(shared_mutator_count); + input_iter p(val); (*p).mutator(); p->mutator(); + BOOST_TEST_EQ(val.increment_count, 0); + BOOST_TEST_EQ(val.private_mutator_count, 0); // mutator() should be invoked on an object returned by value + BOOST_TEST_EQ(shared_mutator_count, 2); same_type(p.operator->()); } + { + // Test that accessing dereferenced value of a post-incremented iterator works + int shared_mutator_count = 0; + value val(shared_mutator_count); + input_iter p(val); + (*p++).mutator(); + (p++)->mutator(); + BOOST_TEST_EQ(val.increment_count, 2); + BOOST_TEST_EQ(val.private_mutator_count, 0); // mutator() should be invoked on an object returned by value + BOOST_TEST_EQ(shared_mutator_count, 2); + } + { int x = 0; iterator_with_proxy_reference i(x); From e8fbd92a61d075a749baf64dcbace698f904e0fb Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Sun, 7 May 2023 14:23:16 +0200 Subject: [PATCH 076/173] Use `BOOST_STATIC_ASSERT` instead of `BOOST_MPL_ASSERT` (#78) The MPL version is slower to compile and `BOOST_STATIC_ASSERT` is already used in some places. So unify that. This also fixes `Wzero-as-null-pointer-constant` warnings, see https://github.com/boostorg/mpl/pull/75 --- .../detail/facade_iterator_category.hpp | 21 +++++++++---------- include/boost/iterator/iterator_concepts.hpp | 4 ++-- test/iterator_facade.cpp | 2 +- test/static_assert_same.hpp | 8 +++---- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/include/boost/iterator/detail/facade_iterator_category.hpp b/include/boost/iterator/detail/facade_iterator_category.hpp index 6db45e453..9d41320f6 100644 --- a/include/boost/iterator/detail/facade_iterator_category.hpp +++ b/include/boost/iterator/detail/facade_iterator_category.hpp @@ -13,15 +13,14 @@ # include # include # include -# include + +# include # include # include # include # include -# include - # include // try to keep this last # ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY @@ -139,17 +138,17 @@ struct iterator_category_with_traversal // Make sure this isn't used to build any categories where // convertibility to Traversal is redundant. Should just use the // Category element in that case. - BOOST_MPL_ASSERT_NOT(( - is_convertible< + BOOST_STATIC_ASSERT(( + !is_convertible< typename iterator_category_to_traversal::type , Traversal - >)); + >::value)); - BOOST_MPL_ASSERT((is_iterator_category)); - BOOST_MPL_ASSERT_NOT((is_iterator_category)); - BOOST_MPL_ASSERT_NOT((is_iterator_traversal)); + BOOST_STATIC_ASSERT(is_iterator_category::value); + BOOST_STATIC_ASSERT(!is_iterator_category::value); + BOOST_STATIC_ASSERT(!is_iterator_traversal::value); # if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) - BOOST_MPL_ASSERT((is_iterator_traversal)); + BOOST_STATIC_ASSERT(is_iterator_traversal::value); # endif }; @@ -158,7 +157,7 @@ struct iterator_category_with_traversal template struct facade_iterator_category_impl { - BOOST_MPL_ASSERT_NOT((is_iterator_category)); + BOOST_STATIC_ASSERT(!is_iterator_category::value); typedef typename iterator_facade_default_category< Traversal,ValueParam,Reference diff --git a/include/boost/iterator/iterator_concepts.hpp b/include/boost/iterator/iterator_concepts.hpp index 415cc496a..3c65553e8 100644 --- a/include/boost/iterator/iterator_concepts.hpp +++ b/include/boost/iterator/iterator_concepts.hpp @@ -144,8 +144,8 @@ namespace boost_concepts { typedef typename std::iterator_traits::difference_type difference_type; - BOOST_MPL_ASSERT((boost::is_integral)); - BOOST_MPL_ASSERT_RELATION(std::numeric_limits::is_signed, ==, true); + BOOST_STATIC_ASSERT(boost::is_integral::value); + BOOST_STATIC_ASSERT(std::numeric_limits::is_signed); BOOST_CONCEPT_ASSERT(( boost::Convertible< diff --git a/test/iterator_facade.cpp b/test/iterator_facade.cpp index 33e678add..79c01618e 100644 --- a/test/iterator_facade.cpp +++ b/test/iterator_facade.cpp @@ -147,7 +147,7 @@ struct iterator_with_proxy_reference template void same_type(U const&) -{ BOOST_MPL_ASSERT((boost::is_same)); } +{ BOOST_STATIC_ASSERT((boost::is_same::value)); } template struct abstract_iterator diff --git a/test/static_assert_same.hpp b/test/static_assert_same.hpp index 6df0506ba..5d96da935 100644 --- a/test/static_assert_same.hpp +++ b/test/static_assert_same.hpp @@ -5,15 +5,15 @@ #ifndef STATIC_ASSERT_SAME_DWA2003530_HPP # define STATIC_ASSERT_SAME_DWA2003530_HPP -#include -# include +#include +#include -#define STATIC_ASSERT_SAME( T1,T2 ) BOOST_MPL_ASSERT((::boost::is_same< T1, T2 >)) +#define STATIC_ASSERT_SAME( T1,T2 ) BOOST_STATIC_ASSERT((::boost::is_same< T1, T2 >::value)) template struct static_assert_same { - BOOST_MPL_ASSERT((::boost::is_same< T1, T2 >)); + STATIC_ASSERT_SAME(T1, T2); enum { value = 1 }; }; From 85b542e1b61e5c74c9ddc5b0204e317c6f317ebf Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 21 May 2023 00:18:27 +0300 Subject: [PATCH 077/173] Extracted is_iterator trait to a separate header. Also, reworked is_iterator to be more robust against various corner cases and added dedicated tests for the type trait. --- include/boost/iterator/is_iterator.hpp | 148 ++++++++++++++++++++++ include/boost/next_prior.hpp | 47 +------ test/Jamfile.v2 | 2 + test/is_iterator.cpp | 164 +++++++++++++++++++++++++ 4 files changed, 317 insertions(+), 44 deletions(-) create mode 100644 include/boost/iterator/is_iterator.hpp create mode 100644 test/is_iterator.cpp diff --git a/include/boost/iterator/is_iterator.hpp b/include/boost/iterator/is_iterator.hpp new file mode 100644 index 000000000..5740b19eb --- /dev/null +++ b/include/boost/iterator/is_iterator.hpp @@ -0,0 +1,148 @@ +/* + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * https://www.boost.org/LICENSE_1_0.txt) + * + * Copyright (c) 2023 Andrey Semashev + */ +/*! + * \file iterator/is_iterator.hpp + * + * This header contains definition of the \c is_iterator type trait. + */ + +#ifndef BOOST_ITERATOR_IS_ITERATOR_HPP_INCLUDED_ +#define BOOST_ITERATOR_IS_ITERATOR_HPP_INCLUDED_ + +#include +#include +#include +#include +#include +#include +#include +#if !defined(BOOST_NO_CXX17_ITERATOR_TRAITS) +#include +#endif + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost { +namespace iterators { +namespace detail { + +// The trait attempts to detect if the T type is an iterator class. Class-type iterators are assumed +// to have the nested type iterator_category. Strictly speaking, this is not required to be the +// case (e.g. a user can specialize iterator_traits for T without defining T::iterator_category). +// Still, this is a good heuristic in practice, and we can't do anything better anyway. +// Since C++17 we can test for iterator_traits::iterator_category presence instead as it is +// required to be only present for iterators. +namespace has_iterator_category_detail { + +typedef char yes_type; +struct no_type { char padding[2]; }; + +template< typename T > +yes_type check( +#if !defined(BOOST_NO_CXX17_ITERATOR_TRAITS) + typename std::iterator_traits< T >::iterator_category* +#else + typename T::iterator_category* +#endif +); +template< typename > +no_type check(...); + +} // namespace has_iterator_category_detail + +template< typename T > +struct is_iterator_impl : + public boost::integral_constant< + bool, + sizeof(has_iterator_category_detail::check< T >(0)) == sizeof(has_iterator_category_detail::yes_type) + > +{ +}; + +template< typename T > +struct is_iterator_impl< T* > : + public boost::conjunction< + boost::is_complete< T >, + boost::negation< boost::is_function< T > > + >::type +{ +}; + +template< typename T, typename U > +struct is_iterator_impl< T U::* > : + public boost::false_type +{ +}; + +template< typename T > +struct is_iterator_impl< T& > : + public boost::false_type +{ +}; + +template< typename T, std::size_t N > +struct is_iterator_impl< T[N] > : + public boost::false_type +{ +}; + +#if !defined(BOOST_TT_HAS_WORKING_IS_COMPLETE) +template< typename T > +struct is_iterator_impl< T[] > : + public boost::false_type +{ +}; + +template< > +struct is_iterator_impl< void > : + public boost::false_type +{ +}; + +template< > +struct is_iterator_impl< void* > : + public boost::false_type +{ +}; +#endif // !defined(BOOST_TT_HAS_WORKING_IS_COMPLETE) + +} // namespace detail + +/*! + * \brief The type trait detects whether the type \c T is an iterator type. + * + * The type trait yields \c true if its argument type \c T, after stripping top level + * cv qualifiers, is one of the following: + * + * - A pointer type, other than a pointer to function, a pointer to a class member, + * or a pointer to an incomplete type, including `void`. + * - A class type for which an iterator category is obtainable. Prior to C++17, + * the iterator category must be defined as a public `T::iterator_category` type. + * Since C++17, the expression `std::iterator_traits< T >::iterator_category` must + * be valid and produce the iterator category type. + * + * Otherwise, the type trait yields \c false. + */ +template< typename T > +struct is_iterator : public detail::is_iterator_impl< T >::type {}; +template< typename T > +struct is_iterator< const T > : public detail::is_iterator_impl< T >::type {}; +template< typename T > +struct is_iterator< volatile T > : public detail::is_iterator_impl< T >::type {}; +template< typename T > +struct is_iterator< const volatile T > : public detail::is_iterator_impl< T >::type {}; + +} // namespace iterators + +using iterators::is_iterator; + +} // namespace boost + +#endif // BOOST_ITERATOR_IS_ITERATOR_HPP_INCLUDED_ diff --git a/include/boost/next_prior.hpp b/include/boost/next_prior.hpp index 5de705f59..d943b97f6 100644 --- a/include/boost/next_prior.hpp +++ b/include/boost/next_prior.hpp @@ -15,13 +15,12 @@ #ifndef BOOST_NEXT_PRIOR_HPP_INCLUDED #define BOOST_NEXT_PRIOR_HPP_INCLUDED -#include #include -#include #include #include #include #include +#include #include #include @@ -39,46 +38,6 @@ namespace boost { namespace next_prior_detail { -// The trait attempts to detect if the T type is an iterator. Class-type iterators are assumed -// to have the nested type iterator_category. Strictly speaking, this is not required to be the -// case (e.g. a user can specialize iterator_traits for T without defining T::iterator_category). -// Still, this is a good heuristic in practice, and we can't do anything better anyway. -// Since C++17 we can test for iterator_traits::iterator_category presence instead as it is -// required to be only present for iterators. -template< typename T, typename Void = void > -struct is_iterator_class -{ - static BOOST_CONSTEXPR_OR_CONST bool value = false; -}; - -template< typename T > -struct is_iterator_class< - T, - typename enable_if_has_type< -#if !defined(BOOST_NO_CXX17_ITERATOR_TRAITS) - typename std::iterator_traits< T >::iterator_category -#else - typename T::iterator_category -#endif - >::type -> -{ - static BOOST_CONSTEXPR_OR_CONST bool value = true; -}; - -template< typename T > -struct is_iterator : - public is_iterator_class< T > -{ -}; - -template< typename T > -struct is_iterator< T* > -{ - static BOOST_CONSTEXPR_OR_CONST bool value = true; -}; - - template< typename T, typename Distance, bool HasPlus = has_plus< T, Distance >::value > struct next_plus_impl; @@ -107,7 +66,7 @@ struct next_plus_assign_impl< T, Distance, true > } }; -template< typename T, typename Distance, bool IsIterator = is_iterator< T >::value > +template< typename T, typename Distance, bool IsIterator = boost::iterators::is_iterator< T >::value > struct next_advance_impl : public next_plus_assign_impl< T, Distance > { @@ -152,7 +111,7 @@ struct prior_minus_assign_impl< T, Distance, true > } }; -template< typename T, typename Distance, bool IsIterator = is_iterator< T >::value > +template< typename T, typename Distance, bool IsIterator = boost::iterators::is_iterator< T >::value > struct prior_advance_impl : public prior_minus_assign_impl< T, Distance > { diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 96e440bdf..0cd9b7fe5 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -26,6 +26,8 @@ test-suite iterator [ run zip_iterator_test_std_tuple.cpp ] [ run zip_iterator_test_std_pair.cpp ] + [ run is_iterator.cpp ] + # These tests should work for just about everything. [ compile is_lvalue_iterator.cpp ] [ compile is_readable_iterator.cpp ] diff --git a/test/is_iterator.cpp b/test/is_iterator.cpp new file mode 100644 index 000000000..7d67dda13 --- /dev/null +++ b/test/is_iterator.cpp @@ -0,0 +1,164 @@ +/* + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * https://www.boost.org/LICENSE_1_0.txt) + * + * Copyright (c) 2023 Andrey Semashev + */ +/*! + * \file is_iterator.cpp + * + * This header contains tests for the \c is_iterator type trait. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +template< typename T > +struct value_iterator +{ + typedef std::input_iterator_tag iterator_category; + typedef T value_type; + typedef std::ptrdiff_t difference_type; + typedef T* pointer; + typedef T& reference; + + value_type operator*() const; +}; + +template< typename T > +struct proxy_iterator +{ + typedef T value_type; + typedef std::output_iterator_tag iterator_category; + typedef std::ptrdiff_t difference_type; + typedef T* pointer; + typedef T& reference; + + struct proxy + { + operator value_type&() const; + proxy& operator=(value_type) const; + }; + + proxy operator*() const; +}; + +template< typename T > +struct lvalue_iterator +{ + typedef T value_type; + typedef T& reference; + typedef T difference_type; + typedef std::input_iterator_tag iterator_category; + typedef T* pointer; + + T& operator*() const; + lvalue_iterator& operator++(); + lvalue_iterator operator++(int); +}; + +template< typename T > +struct constant_lvalue_iterator +{ + typedef T value_type; + typedef T const& reference; + typedef T difference_type; + typedef std::input_iterator_tag iterator_category; + typedef T const* pointer; + + T const& operator*() const; + constant_lvalue_iterator& operator++(); + constant_lvalue_iterator operator++(int); +}; + +template< typename Iterator > +class adapted_iterator : + public boost::iterators::iterator_adaptor< adapted_iterator< Iterator >, Iterator > +{ + friend class iterator_core_access; + +private: + typedef boost::iterators::iterator_adaptor< adapted_iterator< Iterator >, Iterator > base_type; + +private: + typename base_type::reference dereference() const; + void increment(); + void decrement(); + void advance(typename base_type::difference_type n); + template< typename OtherIterator > + typename base_type::difference_type distance_to(adapted_iterator< OtherIterator > const& y) const; +}; + +struct complete {}; +struct incomplete; + +int main() +{ + BOOST_TEST(boost::iterators::is_iterator< int* >::value); + BOOST_TEST(boost::iterators::is_iterator< const int* >::value); + BOOST_TEST(boost::iterators::is_iterator< complete* >::value); + BOOST_TEST(boost::iterators::is_iterator< std::reverse_iterator< int* > >::value); + BOOST_TEST(boost::iterators::is_iterator< std::reverse_iterator< complete* > >::value); + BOOST_TEST(boost::iterators::is_iterator< adapted_iterator< int* > >::value); + + BOOST_TEST(boost::iterators::is_iterator< std::string::iterator >::value); + BOOST_TEST(boost::iterators::is_iterator< std::string::const_iterator >::value); + BOOST_TEST(boost::iterators::is_iterator< std::string::reverse_iterator >::value); + BOOST_TEST(boost::iterators::is_iterator< std::string::const_reverse_iterator >::value); + + BOOST_TEST(boost::iterators::is_iterator< std::list< int >::iterator >::value); + BOOST_TEST(boost::iterators::is_iterator< std::list< int >::const_iterator >::value); + BOOST_TEST(boost::iterators::is_iterator< std::list< int >::reverse_iterator >::value); + BOOST_TEST(boost::iterators::is_iterator< std::list< int >::const_reverse_iterator >::value); + + BOOST_TEST(boost::iterators::is_iterator< std::vector< int >::iterator >::value); + BOOST_TEST(boost::iterators::is_iterator< std::vector< int >::const_iterator >::value); + BOOST_TEST(boost::iterators::is_iterator< std::vector< int >::reverse_iterator >::value); + BOOST_TEST(boost::iterators::is_iterator< std::vector< int >::const_reverse_iterator >::value); + + BOOST_TEST(boost::iterators::is_iterator< std::insert_iterator< std::vector< int > > >::value); + BOOST_TEST(boost::iterators::is_iterator< std::back_insert_iterator< std::vector< int > > >::value); + BOOST_TEST(boost::iterators::is_iterator< std::front_insert_iterator< std::vector< int > > >::value); + BOOST_TEST(boost::iterators::is_iterator< std::istream_iterator< int > >::value); + BOOST_TEST(boost::iterators::is_iterator< std::ostream_iterator< int > >::value); + BOOST_TEST(boost::iterators::is_iterator< std::istreambuf_iterator< char > >::value); + BOOST_TEST(boost::iterators::is_iterator< std::ostreambuf_iterator< char > >::value); + + BOOST_TEST(!boost::iterators::is_iterator< int >::value); + BOOST_TEST(!boost::iterators::is_iterator< complete >::value); + BOOST_TEST(!boost::iterators::is_iterator< void >::value); + BOOST_TEST(!boost::iterators::is_iterator< const void >::value); + BOOST_TEST(!boost::iterators::is_iterator< void* >::value); +#if defined(BOOST_TT_HAS_WORKING_IS_COMPLETE) + BOOST_TEST(!boost::iterators::is_iterator< incomplete >::value); + BOOST_TEST(!boost::iterators::is_iterator< incomplete* >::value); +#endif + BOOST_TEST(!boost::iterators::is_iterator< int (int) >::value); + BOOST_TEST(!boost::iterators::is_iterator< int (*)(int) >::value); + BOOST_TEST(!boost::iterators::is_iterator< int complete::* >::value); + BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) >::value); + BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) const >::value); +#if defined(__cpp_noexcept_function_type) && (__cpp_noexcept_function_type >= 201510L) + BOOST_TEST(!boost::iterators::is_iterator< int (*)(int) noexcept >::value); + BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) noexcept >::value); + BOOST_TEST(!boost::iterators::is_iterator< int (complete::*)(int) const noexcept >::value); +#endif + BOOST_TEST(!boost::iterators::is_iterator< int[] >::value); + BOOST_TEST(!boost::iterators::is_iterator< int[10] >::value); + BOOST_TEST(!boost::iterators::is_iterator< int*[] >::value); + BOOST_TEST(!boost::iterators::is_iterator< int*[10] >::value); + + BOOST_TEST(!boost::iterators::is_iterator< int& >::value); + BOOST_TEST(!boost::iterators::is_iterator< int*& >::value); + BOOST_TEST(!boost::iterators::is_iterator< int (&)(int) >::value); + BOOST_TEST(!boost::iterators::is_iterator< int (&)[10] >::value); + + return boost::report_errors(); +} From 6d02c36718fbc61f89d842930418e88008981a9d Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 5 Jun 2023 03:17:56 +0300 Subject: [PATCH 078/173] Add clang-16 CI jobs, switch to clang-15 from stock Ubuntu repos. --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1f40f65a..fb9ed23ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -236,10 +236,6 @@ jobs: os: ubuntu-22.04 install: - clang-15 - sources: - - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" - source_keys: - - "https://apt.llvm.org/llvm-snapshot.gpg.key" - toolset: clang compiler: clang++-15 cxxstd: "03,11,14,17,20,2b" @@ -248,15 +244,35 @@ jobs: - clang-15 - libc++-15-dev - libc++abi-15-dev + cxxflags: -stdlib=libc++ + linkflags: -stdlib=libc++ + - toolset: clang + compiler: clang++-16 + cxxstd: "03,11,14,17,20,2b" + os: ubuntu-22.04 + install: + - clang-16 + sources: + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" + source_keys: + - "https://apt.llvm.org/llvm-snapshot.gpg.key" + - toolset: clang + compiler: clang++-16 + cxxstd: "03,11,14,17,20,2b" + os: ubuntu-22.04 + install: + - clang-16 + - libc++-16-dev + - libc++abi-16-dev sources: - - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" source_keys: - "https://apt.llvm.org/llvm-snapshot.gpg.key" cxxflags: -stdlib=libc++ linkflags: -stdlib=libc++ - name: UBSAN toolset: clang - compiler: clang++-14 + compiler: clang++-15 cxxstd: "03,11,14,17,20,2b" cxxflags: -stdlib=libc++ linkflags: -stdlib=libc++ @@ -264,9 +280,9 @@ jobs: build_variant: debug os: ubuntu-22.04 install: - - clang-14 - - libc++-14-dev - - libc++abi-14-dev + - clang-15 + - libc++-15-dev + - libc++abi-15-dev - toolset: clang cxxstd: "03,11,14,17,2a" From d11499c08c004e57ad92b127663f4db691d4f2be Mon Sep 17 00:00:00 2001 From: Brian Weed Date: Thu, 22 Jun 2023 14:06:19 -0400 Subject: [PATCH 079/173] Performance improvement: (#79) Performance improvement: Add move semantics to by-value parameters (iterator and predicate), to eliminate the cost of copy-construction. Both the Predicate (Normally a std::function, or lambda), and custom iterators can have state, which can be expensive to copy. Profiler identified this as a bottleneck while using boost::adaptors::filtered. --- include/boost/iterator/filter_iterator.hpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/include/boost/iterator/filter_iterator.hpp b/include/boost/iterator/filter_iterator.hpp index b87c02b0a..a03f653f9 100644 --- a/include/boost/iterator/filter_iterator.hpp +++ b/include/boost/iterator/filter_iterator.hpp @@ -12,6 +12,14 @@ #include #include +#include + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +#include +#define BOOST_ITERATOR_DETAIL_MOVE(x) std::move(x) +#else +#define BOOST_ITERATOR_DETAIL_MOVE(x) x +#endif namespace boost { namespace iterators { @@ -54,13 +62,13 @@ namespace iterators { filter_iterator() { } filter_iterator(Predicate f, Iterator x, Iterator end_ = Iterator()) - : super_t(x), m_predicate(f), m_end(end_) + : super_t(BOOST_ITERATOR_DETAIL_MOVE(x)), m_predicate(BOOST_ITERATOR_DETAIL_MOVE(f)), m_end(BOOST_ITERATOR_DETAIL_MOVE(end_)) { satisfy_predicate(); } filter_iterator(Iterator x, Iterator end_ = Iterator()) - : super_t(x), m_predicate(), m_end(end_) + : super_t(BOOST_ITERATOR_DETAIL_MOVE(x)), m_predicate(), m_end(BOOST_ITERATOR_DETAIL_MOVE(end_)) { // Pro8 is a little too aggressive about instantiating the // body of this function. @@ -111,7 +119,7 @@ namespace iterators { inline filter_iterator make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator()) { - return filter_iterator(f,x,end); + return filter_iterator(BOOST_ITERATOR_DETAIL_MOVE(f),BOOST_ITERATOR_DETAIL_MOVE(x),BOOST_ITERATOR_DETAIL_MOVE(end)); } template @@ -123,7 +131,7 @@ namespace iterators { >::type x , Iterator end = Iterator()) { - return filter_iterator(x,end); + return filter_iterator(BOOST_ITERATOR_DETAIL_MOVE(x),BOOST_ITERATOR_DETAIL_MOVE(end)); } } // namespace iterators @@ -133,4 +141,6 @@ using iterators::make_filter_iterator; } // namespace boost +#undef BOOST_ITERATOR_DETAIL_MOVE + #endif // BOOST_FILTER_ITERATOR_23022003THW_HPP From 80bb1ac9e401d0d679718e29bef2f2aaf0123fcb Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 22 Jun 2023 21:14:03 +0300 Subject: [PATCH 080/173] Avoid including , added a missing include. --- include/boost/iterator/filter_iterator.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/boost/iterator/filter_iterator.hpp b/include/boost/iterator/filter_iterator.hpp index a03f653f9..18c6186aa 100644 --- a/include/boost/iterator/filter_iterator.hpp +++ b/include/boost/iterator/filter_iterator.hpp @@ -13,12 +13,12 @@ #include #include #include +#include #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -#include -#define BOOST_ITERATOR_DETAIL_MOVE(x) std::move(x) +#define BOOST_ITERATOR_DETAIL_MOVE(_type, _value) static_cast< _type&& >(_value) #else -#define BOOST_ITERATOR_DETAIL_MOVE(x) x +#define BOOST_ITERATOR_DETAIL_MOVE(_type, _value) _value #endif namespace boost { @@ -62,13 +62,13 @@ namespace iterators { filter_iterator() { } filter_iterator(Predicate f, Iterator x, Iterator end_ = Iterator()) - : super_t(BOOST_ITERATOR_DETAIL_MOVE(x)), m_predicate(BOOST_ITERATOR_DETAIL_MOVE(f)), m_end(BOOST_ITERATOR_DETAIL_MOVE(end_)) + : super_t(BOOST_ITERATOR_DETAIL_MOVE(Iterator, x)), m_predicate(BOOST_ITERATOR_DETAIL_MOVE(Predicate, f)), m_end(BOOST_ITERATOR_DETAIL_MOVE(Iterator, end_)) { satisfy_predicate(); } filter_iterator(Iterator x, Iterator end_ = Iterator()) - : super_t(BOOST_ITERATOR_DETAIL_MOVE(x)), m_predicate(), m_end(BOOST_ITERATOR_DETAIL_MOVE(end_)) + : super_t(BOOST_ITERATOR_DETAIL_MOVE(Iterator, x)), m_predicate(), m_end(BOOST_ITERATOR_DETAIL_MOVE(Iterator, end_)) { // Pro8 is a little too aggressive about instantiating the // body of this function. @@ -119,7 +119,7 @@ namespace iterators { inline filter_iterator make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator()) { - return filter_iterator(BOOST_ITERATOR_DETAIL_MOVE(f),BOOST_ITERATOR_DETAIL_MOVE(x),BOOST_ITERATOR_DETAIL_MOVE(end)); + return filter_iterator(BOOST_ITERATOR_DETAIL_MOVE(Predicate, f), BOOST_ITERATOR_DETAIL_MOVE(Iterator, x), BOOST_ITERATOR_DETAIL_MOVE(Iterator, end)); } template @@ -131,7 +131,7 @@ namespace iterators { >::type x , Iterator end = Iterator()) { - return filter_iterator(BOOST_ITERATOR_DETAIL_MOVE(x),BOOST_ITERATOR_DETAIL_MOVE(end)); + return filter_iterator(BOOST_ITERATOR_DETAIL_MOVE(Iterator, x), BOOST_ITERATOR_DETAIL_MOVE(Iterator, end)); } } // namespace iterators From a9dabd3c657e422fb3487fe9bc5cfddf2ae82dd9 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 17 Nov 2023 04:25:29 +0300 Subject: [PATCH 081/173] Removed dependency on Boost.Conversion in tests. This reduces the minimum supported compilers versions. --- include/boost/pending/iterator_tests.hpp | 10 ++++++---- test/iterator_facade.cpp | 5 ++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/boost/pending/iterator_tests.hpp b/include/boost/pending/iterator_tests.hpp index 46dc42085..a68368365 100644 --- a/include/boost/pending/iterator_tests.hpp +++ b/include/boost/pending/iterator_tests.hpp @@ -22,7 +22,6 @@ # include # include # include // for detail::dummy_constructor -# include # include # include # include @@ -223,12 +222,15 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals) int c; typedef typename std::iterator_traits::value_type value_type; - boost::ignore_unused(); + struct local + { + static value_type to_value_type(value_type v) { return v; } + }; for (c = 0; c < N-1; ++c) { BOOST_TEST(i == j + c); BOOST_TEST(*i == vals[c]); - BOOST_TEST(*i == boost::implicit_cast(j[c])); + BOOST_TEST(*i == local::to_value_type(j[c])); BOOST_TEST(*i == *(j + c)); BOOST_TEST(*i == *(c + j)); ++i; @@ -242,7 +244,7 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals) for (c = 0; c < N-1; ++c) { BOOST_TEST(i == k - c); BOOST_TEST(*i == vals[N - 1 - c]); - BOOST_TEST(*i == boost::implicit_cast(j[N - 1 - c])); + BOOST_TEST(*i == local::to_value_type(j[N - 1 - c])); Iterator q = k - c; boost::ignore_unused(q); BOOST_TEST(*i == *q); diff --git a/test/iterator_facade.cpp b/test/iterator_facade.cpp index 79c01618e..7351dd3fc 100644 --- a/test/iterator_facade.cpp +++ b/test/iterator_facade.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -188,12 +187,12 @@ struct derived : base virtual void assign(const base &b) { - state = boost::polymorphic_cast(&b)->state; + state = dynamic_cast(b).state; } virtual bool equal(const base &b) const { - return state == boost::polymorphic_cast(&b)->state; + return state == dynamic_cast(b).state; } int state; From d09f78ae9b884804fc66ded9d0dc5f7b500c665e Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 17 Nov 2023 04:46:21 +0300 Subject: [PATCH 082/173] Removed C++03 CI jobs. --- .github/workflows/ci.yml | 78 ++++++++++++++++++---------------------- appveyor.yml | 13 +++---- 2 files changed, 40 insertions(+), 51 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb9ed23ec..519df305b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,16 +33,8 @@ jobs: matrix: include: # Linux, gcc - - toolset: gcc-4.4 - cxxstd: "98,0x" - os: ubuntu-latest - container: ubuntu:16.04 - install: - - g++-4.4 - sources: - - "ppa:ubuntu-toolchain-r/test" - toolset: gcc-4.6 - cxxstd: "03,0x" + cxxstd: "0x" os: ubuntu-latest container: ubuntu:16.04 install: @@ -50,70 +42,70 @@ jobs: sources: - "ppa:ubuntu-toolchain-r/test" - toolset: gcc-4.7 - cxxstd: "03,11" + cxxstd: "11" os: ubuntu-latest container: ubuntu:16.04 install: - g++-4.7 - toolset: gcc-4.8 - cxxstd: "03,11" + cxxstd: "11" os: ubuntu-latest container: ubuntu:18.04 install: - g++-4.8 - toolset: gcc-4.9 - cxxstd: "03,11" + cxxstd: "11" os: ubuntu-latest container: ubuntu:16.04 install: - g++-4.9 - toolset: gcc-5 - cxxstd: "03,11,14,1z" + cxxstd: "11,14,1z" os: ubuntu-latest container: ubuntu:16.04 install: - g++-5 - toolset: gcc-6 - cxxstd: "03,11,14,1z" + cxxstd: "11,14,1z" os: ubuntu-latest container: ubuntu:18.04 install: - g++-6 - toolset: gcc-7 - cxxstd: "03,11,14,17" + cxxstd: "11,14,17" os: ubuntu-latest container: ubuntu:18.04 install: - g++-7 - toolset: gcc-8 - cxxstd: "03,11,14,17,2a" + cxxstd: "11,14,17,2a" os: ubuntu-latest container: ubuntu:18.04 install: - g++-8 - toolset: gcc-9 - cxxstd: "03,11,14,17,2a" + cxxstd: "11,14,17,2a" os: ubuntu-20.04 install: - g++-9 - toolset: gcc-10 - cxxstd: "03,11,14,17,20" + cxxstd: "11,14,17,20" os: ubuntu-20.04 install: - g++-10 - toolset: gcc-11 - cxxstd: "03,11,14,17,20,23" + cxxstd: "11,14,17,20,23" os: ubuntu-22.04 install: - g++-11 - toolset: gcc-12 - cxxstd: "03,11,14,17,20,23" + cxxstd: "11,14,17,20,23" os: ubuntu-22.04 install: - g++-12 - name: UBSAN toolset: gcc-11 - cxxstd: "03,11,14,17,20,23" + cxxstd: "11,14,17,20,23" ubsan: 1 build_variant: debug os: ubuntu-22.04 @@ -123,63 +115,63 @@ jobs: # Linux, clang - toolset: clang compiler: clang++-3.5 - cxxstd: "03,11" + cxxstd: "11" os: ubuntu-latest container: ubuntu:16.04 install: - clang-3.5 - toolset: clang compiler: clang++-3.6 - cxxstd: "03,11,14" + cxxstd: "11,14" os: ubuntu-latest container: ubuntu:16.04 install: - clang-3.6 - toolset: clang compiler: clang++-3.7 - cxxstd: "03,11,14" + cxxstd: "11,14" os: ubuntu-latest container: ubuntu:16.04 install: - clang-3.7 - toolset: clang compiler: clang++-3.8 - cxxstd: "03,11,14" + cxxstd: "11,14" os: ubuntu-latest container: ubuntu:16.04 install: - clang-3.8 - toolset: clang compiler: clang++-3.9 - cxxstd: "03,11,14" + cxxstd: "11,14" os: ubuntu-latest container: ubuntu:18.04 install: - clang-3.9 - toolset: clang compiler: clang++-4.0 - cxxstd: "03,11,14" + cxxstd: "11,14" os: ubuntu-latest container: ubuntu:18.04 install: - clang-4.0 - toolset: clang compiler: clang++-5.0 - cxxstd: "03,11,14,1z" + cxxstd: "11,14,1z" os: ubuntu-latest container: ubuntu:18.04 install: - clang-5.0 - toolset: clang compiler: clang++-6.0 - cxxstd: "03,11,14,17" + cxxstd: "11,14,17" os: ubuntu-latest container: ubuntu:18.04 install: - clang-6.0 - toolset: clang compiler: clang++-7 - cxxstd: "03,11,14,17" + cxxstd: "11,14,17" os: ubuntu-latest container: ubuntu:18.04 install: @@ -187,7 +179,7 @@ jobs: # Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode - toolset: clang compiler: clang++-8 - cxxstd: "03,11,14,17,2a" + cxxstd: "11,14,17,2a" os: ubuntu-latest container: ubuntu:18.04 install: @@ -196,49 +188,49 @@ jobs: gcc_toolchain: 7 - toolset: clang compiler: clang++-9 - cxxstd: "03,11,14,17,2a" + cxxstd: "11,14,17,2a" os: ubuntu-20.04 install: - clang-9 - toolset: clang compiler: clang++-10 - cxxstd: "03,11,14,17,20" + cxxstd: "11,14,17,20" os: ubuntu-20.04 install: - clang-10 - toolset: clang compiler: clang++-11 - cxxstd: "03,11,14,17,20" + cxxstd: "11,14,17,20" os: ubuntu-22.04 install: - clang-11 - toolset: clang compiler: clang++-12 - cxxstd: "03,11,14,17,20,2b" + cxxstd: "11,14,17,20,2b" os: ubuntu-22.04 install: - clang-12 - toolset: clang compiler: clang++-13 - cxxstd: "03,11,14,17,20,2b" + cxxstd: "11,14,17,20,2b" os: ubuntu-22.04 install: - clang-13 - toolset: clang compiler: clang++-14 - cxxstd: "03,11,14,17,20,2b" + cxxstd: "11,14,17,20,2b" os: ubuntu-22.04 install: - clang-14 - toolset: clang compiler: clang++-15 - cxxstd: "03,11,14,17,20,2b" + cxxstd: "11,14,17,20,2b" os: ubuntu-22.04 install: - clang-15 - toolset: clang compiler: clang++-15 - cxxstd: "03,11,14,17,20,2b" + cxxstd: "11,14,17,20,2b" os: ubuntu-22.04 install: - clang-15 @@ -248,7 +240,7 @@ jobs: linkflags: -stdlib=libc++ - toolset: clang compiler: clang++-16 - cxxstd: "03,11,14,17,20,2b" + cxxstd: "11,14,17,20,2b" os: ubuntu-22.04 install: - clang-16 @@ -258,7 +250,7 @@ jobs: - "https://apt.llvm.org/llvm-snapshot.gpg.key" - toolset: clang compiler: clang++-16 - cxxstd: "03,11,14,17,20,2b" + cxxstd: "11,14,17,20,2b" os: ubuntu-22.04 install: - clang-16 @@ -273,7 +265,7 @@ jobs: - name: UBSAN toolset: clang compiler: clang++-15 - cxxstd: "03,11,14,17,20,2b" + cxxstd: "11,14,17,20,2b" cxxflags: -stdlib=libc++ linkflags: -stdlib=libc++ ubsan: 1 @@ -285,7 +277,7 @@ jobs: - libc++abi-15-dev - toolset: clang - cxxstd: "03,11,14,17,2a" + cxxstd: "11,14,17,2a" os: macos-11 timeout-minutes: 60 diff --git a/appveyor.yml b/appveyor.yml index 8cf1ba5f6..251466e41 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,9 +15,6 @@ branches: environment: matrix: - - TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0 - ADDRMD: 32 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: msvc-12.0 ADDRMD: 32,64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 @@ -42,23 +39,23 @@ environment: CXXSTD: 14,17,latest APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - TOOLSET: gcc - CXXSTD: 03,11,14,1z + CXXSTD: 11,14,1z ADDPATH: C:\cygwin\bin; APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: gcc - CXXSTD: 03,11,14,1z + CXXSTD: 11,14,1z ADDPATH: C:\cygwin64\bin; APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: gcc - CXXSTD: 03,11,14,1z + CXXSTD: 11,14,1z ADDPATH: C:\mingw\bin; APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: gcc - CXXSTD: 03,11,14,1z + CXXSTD: 11,14,1z ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin; APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - TOOLSET: gcc - CXXSTD: 03,11,14,1z + CXXSTD: 11,14,1z ADDPATH: C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin; APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 From c98f965388ac9105969873bc1fc645b227fc1626 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 17 Nov 2023 11:06:21 +0300 Subject: [PATCH 083/173] Use gcc-11 libstdc++ for clang-12 through 15. --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 519df305b..8af59ea53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -210,24 +210,32 @@ jobs: os: ubuntu-22.04 install: - clang-12 + - g++-11 + gcc_toolchain: 11 - toolset: clang compiler: clang++-13 cxxstd: "11,14,17,20,2b" os: ubuntu-22.04 install: - clang-13 + - g++-11 + gcc_toolchain: 11 - toolset: clang compiler: clang++-14 cxxstd: "11,14,17,20,2b" os: ubuntu-22.04 install: - clang-14 + - g++-11 + gcc_toolchain: 11 - toolset: clang compiler: clang++-15 cxxstd: "11,14,17,20,2b" os: ubuntu-22.04 install: - clang-15 + - g++-11 + gcc_toolchain: 11 - toolset: clang compiler: clang++-15 cxxstd: "11,14,17,20,2b" From d72d57fa396917f3d7f4257f75bf0332b20809f6 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 17 Nov 2023 17:24:02 +0300 Subject: [PATCH 084/173] Removed dependency on Boost.Conversion in CMakeLists.txt. Fixes https://github.com/boostorg/iterator/issues/81. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33a69b213..a0dcf8477 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,6 @@ target_link_libraries(boost_iterator Boost::assert Boost::concept_check Boost::config - Boost::conversion Boost::core Boost::detail Boost::function_types From ae5d7d8c0c578844077ca94b72c526d82fb5d3ba Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 17 Nov 2023 17:47:20 +0300 Subject: [PATCH 085/173] Added a CMake test. --- .github/workflows/ci.yml | 20 +++++++++++++ appveyor.yml | 16 ++++++++++ test/test_cmake/CMakeLists.txt | 20 +++++++++++++ test/test_cmake/main.cpp | 54 ++++++++++++++++++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 test/test_cmake/CMakeLists.txt create mode 100644 test/test_cmake/main.cpp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8af59ea53..49fa33528 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -288,6 +288,10 @@ jobs: cxxstd: "11,14,17,2a" os: macos-11 + - name: CMake tests + cmake_tests: 1 + os: ubuntu-20.04 + timeout-minutes: 60 runs-on: ${{matrix.os}} container: ${{matrix.container}} @@ -486,3 +490,19 @@ jobs: fi B2_ARGS+=("libs/$LIBRARY/test") ./b2 "${B2_ARGS[@]}" + + - name: Run CMake tests + if: matrix.cmake_tests + run: | + if [ -n "${{matrix.macosx_version_min}}" ] + then + export MACOSX_DEPLOYMENT_TARGET="${{matrix.macosx_version_min}}" + fi + cd ../boost-root + mkdir __build_static__ && cd __build_static__ + cmake ../libs/$LIBRARY/test/test_cmake + cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS + cd .. + mkdir __build_shared__ && cd __build_shared__ + cmake -DBUILD_SHARED_LIBS=On ../libs/$LIBRARY/test/test_cmake + cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS diff --git a/appveyor.yml b/appveyor.yml index 251466e41..03d2535bc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -58,6 +58,8 @@ environment: CXXSTD: 11,14,1z ADDPATH: C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin; APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + - TEST_CMAKE: 1 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 install: - set GIT_FETCH_JOBS=8 @@ -84,3 +86,17 @@ test_script: - if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD% - if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD% - b2 -j %NUMBER_OF_PROCESSORS% libs/iterator/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% + +for: + - matrix: + only: [TEST_CMAKE: 1] + test_script: + - mkdir __build_static__ + - cd __build_static__ + - cmake ../libs/iterator/test/test_cmake + - cmake --build . --target boost_iterator_cmake_self_test -j %NUMBER_OF_PROCESSORS% + - cd .. + - mkdir __build_shared__ + - cd __build_shared__ + - cmake -DBUILD_SHARED_LIBS=On ../libs/iterator/test/test_cmake + - cmake --build . --target boost_iterator_cmake_self_test -j %NUMBER_OF_PROCESSORS% diff --git a/test/test_cmake/CMakeLists.txt b/test/test_cmake/CMakeLists.txt new file mode 100644 index 000000000..be363e78d --- /dev/null +++ b/test/test_cmake/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright 2023 Andrey Semashev +# +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt +# +# NOTE: This does NOT run the unit tests for Boost.Atomic. +# It only tests if the CMakeLists.txt file in its root works as expected + +cmake_minimum_required(VERSION 3.5) + +project(BoostIteratorCMakeSelfTest) + +# Use experimental superproject to pull library dependencies recursively +set(BOOST_ENABLE_CMAKE 1) +add_subdirectory(../../../.. "${CMAKE_CURRENT_BINARY_DIR}/boost_superproject") + +add_definitions(-DBOOST_ALL_NO_LIB) + +add_executable(boost_iterator_cmake_self_test main.cpp) +target_link_libraries(boost_iterator_cmake_self_test Boost::iterator) diff --git a/test/test_cmake/main.cpp b/test/test_cmake/main.cpp new file mode 100644 index 000000000..5cf0e590a --- /dev/null +++ b/test/test_cmake/main.cpp @@ -0,0 +1,54 @@ +// Copyright (c) 2023 Andrey Semashev +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template< typename Iterator > +class adapted_iterator : + public boost::iterators::iterator_adaptor< adapted_iterator< Iterator >, Iterator > +{ + friend class iterator_core_access; + +private: + typedef boost::iterators::iterator_adaptor< adapted_iterator< Iterator >, Iterator > base_type; + +public: + explicit adapted_iterator(Iterator it) : base_type(it) {} +}; + +int main() +{ + unsigned char buf[8]; + adapted_iterator< unsigned char* > b(buf), e(buf + sizeof(buf)); + return boost::iterators::distance(b, e) == static_cast< adapted_iterator< unsigned char* >::difference_type >(sizeof(buf)); +} From 9cc1a4fdd1a894a9bc66840238da7ddc7061e8fe Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 3 Jan 2024 01:31:05 +0300 Subject: [PATCH 086/173] Removed $Date$ tags from docs. The tags were not being updated for a long time now and were visible in the final docs. Reported in https://github.com/boostorg/website/issues/762. --- doc/counting_iterator.rst | 1 - doc/default.css | 2 -- doc/facade-and-adaptor.rst | 1 - doc/filter_iterator.rst | 1 - doc/function_output_iterator.rst | 1 - doc/index.html | 2 -- doc/index.rst | 1 - doc/indirect_iterator.rst | 1 - doc/interoperability-revisited.rst | 1 - doc/issues.rst | 1 - doc/iterator_adaptor.rst | 1 - doc/iterator_archetypes.rst | 1 - doc/iterator_concepts.rst | 1 - doc/iterator_facade.rst | 1 - doc/iterator_traits.html | 3 --- doc/iterator_traits.rst | 1 - doc/new-iter-concepts.rst | 1 - doc/permutation_iterator.rst | 1 - doc/pointee.rst | 1 - doc/ref_problem.rst | 1 - doc/reverse_iterator.rst | 1 - doc/transform_iterator.rst | 1 - doc/zip_iterator.rst | 1 - 23 files changed, 27 deletions(-) diff --git a/doc/counting_iterator.rst b/doc/counting_iterator.rst index ff7da3cab..f0377de8b 100644 --- a/doc/counting_iterator.rst +++ b/doc/counting_iterator.rst @@ -11,7 +11,6 @@ :organization: `Boost Consulting`_, Indiana University `Open Systems Lab`_, University of Hanover `Institute for Transport Railway Operation and Construction`_ -:date: $Date$ :copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. .. _`Boost Consulting`: http://www.boost-consulting.com diff --git a/doc/default.css b/doc/default.css index 8c1e34258..a2c4195e7 100644 --- a/doc/default.css +++ b/doc/default.css @@ -1,8 +1,6 @@ /* :Author: David Goodger :Contact: goodger@users.sourceforge.net -:date: $Date$ -:version: $Revision$ :copyright: This stylesheet has been placed in the public domain. boostinspect:nolicense diff --git a/doc/facade-and-adaptor.rst b/doc/facade-and-adaptor.rst index 6308de4c4..cdf6783b1 100644 --- a/doc/facade-and-adaptor.rst +++ b/doc/facade-and-adaptor.rst @@ -10,7 +10,6 @@ :Contact: dave@boost-consulting.com, jsiek@osl.iu.edu, witt@styleadvisor.com :organization: `Boost Consulting`_, Indiana University `Open Systems Lab`_, `Zephyr Associates, Inc.`_ -:date: $Date$ :Number: This is a revised version of N1530_\ =03-0113, which was accepted for Technical Report 1 by the C++ standard diff --git a/doc/filter_iterator.rst b/doc/filter_iterator.rst index cfa8642c8..d4e7a0448 100644 --- a/doc/filter_iterator.rst +++ b/doc/filter_iterator.rst @@ -11,7 +11,6 @@ :organization: `Boost Consulting`_, Indiana University `Open Systems Lab`_, University of Hanover `Institute for Transport Railway Operation and Construction`_ -:date: $Date$ :copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. .. _`Boost Consulting`: http://www.boost-consulting.com diff --git a/doc/function_output_iterator.rst b/doc/function_output_iterator.rst index 8018af5a8..06e791118 100644 --- a/doc/function_output_iterator.rst +++ b/doc/function_output_iterator.rst @@ -11,7 +11,6 @@ :organization: `Boost Consulting`_, Indiana University `Open Systems Lab`_, University of Hanover `Institute for Transport Railway Operation and Construction`_ -:date: $Date$ :copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. .. _`Boost Consulting`: http://www.boost-consulting.com diff --git a/doc/index.html b/doc/index.html index 62274b673..65973b4bf 100644 --- a/doc/index.html +++ b/doc/index.html @@ -26,8 +26,6 @@

The Boost.Iterator Library organizations:Boost Consulting, Indiana University Open Systems Lab, Zephyr Associates, Inc. -date:$Date$ - copyright:Copyright David Abrahams, Jeremy Siek, Thomas Witt 2003. diff --git a/doc/index.rst b/doc/index.rst index 8770b829e..dafacebd9 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -19,7 +19,6 @@ __ ../../../index.htm :Contact: dave@boost-consulting.com, jsiek@osl.iu.edu, witt@styleadvisor.com :organizations: `Boost Consulting`_, Indiana University `Open Systems Lab`_, `Zephyr Associates, Inc.`_ -:date: $Date$ :copyright: Copyright David Abrahams, Jeremy Siek, Thomas Witt 2003. diff --git a/doc/indirect_iterator.rst b/doc/indirect_iterator.rst index 91328e097..7f8c3e704 100644 --- a/doc/indirect_iterator.rst +++ b/doc/indirect_iterator.rst @@ -11,7 +11,6 @@ :organization: `Boost Consulting`_, Indiana University `Open Systems Lab`_, University of Hanover `Institute for Transport Railway Operation and Construction`_ -:date: $Date$ :copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. .. _`Boost Consulting`: http://www.boost-consulting.com diff --git a/doc/interoperability-revisited.rst b/doc/interoperability-revisited.rst index 6fb6acf7e..fd58b3b83 100644 --- a/doc/interoperability-revisited.rst +++ b/doc/interoperability-revisited.rst @@ -2,7 +2,6 @@ Interoperability Revisited ++++++++++++++++++++++++++++ -:date: $Date$ :copyright: Copyright Thomas Witt 2004. .. Distributed under the Boost diff --git a/doc/issues.rst b/doc/issues.rst index a36f5a9ad..c8479fe29 100644 --- a/doc/issues.rst +++ b/doc/issues.rst @@ -8,7 +8,6 @@ :Author: David Abrahams and Jeremy Siek :Contact: dave@boost-consulting.com, jsiek@osl.iu.edu :Organization: `Boost Consulting`_, Indiana University Bloomington -:date: $Date$ :Copyright: Copyright David Abrahams, Jeremy Siek 2003. Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy diff --git a/doc/iterator_adaptor.rst b/doc/iterator_adaptor.rst index 4f8ca0178..7d77d682b 100644 --- a/doc/iterator_adaptor.rst +++ b/doc/iterator_adaptor.rst @@ -11,7 +11,6 @@ :organization: `Boost Consulting`_, Indiana University `Open Systems Lab`_, University of Hanover `Institute for Transport Railway Operation and Construction`_ -:date: $Date$ :copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. .. _`Boost Consulting`: http://www.boost-consulting.com diff --git a/doc/iterator_archetypes.rst b/doc/iterator_archetypes.rst index 827723b0f..c4f524107 100644 --- a/doc/iterator_archetypes.rst +++ b/doc/iterator_archetypes.rst @@ -10,7 +10,6 @@ :Contact: dave@boost-consulting.com, jsiek@osl.iu.edu, witt@styleadvisor.com :organization: `Boost Consulting`_, Indiana University `Open Systems Lab`_, `Zephyr Associates, Inc.`_ -:date: $Date$ :copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2004. .. _`Boost Consulting`: http://www.boost-consulting.com diff --git a/doc/iterator_concepts.rst b/doc/iterator_concepts.rst index 77242a4ea..33f7b24c1 100644 --- a/doc/iterator_concepts.rst +++ b/doc/iterator_concepts.rst @@ -10,7 +10,6 @@ :Contact: dave@boost-consulting.com, jsiek@osl.iu.edu, witt@styleadvisor.com :organization: `Boost Consulting`_, Indiana University `Open Systems Lab`_, `Zephyr Associates, Inc.`_ -:date: $Date$ :copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2004. .. _`Boost Consulting`: http://www.boost-consulting.com diff --git a/doc/iterator_facade.rst b/doc/iterator_facade.rst index 4cbafe6d0..6d6cf48a7 100644 --- a/doc/iterator_facade.rst +++ b/doc/iterator_facade.rst @@ -11,7 +11,6 @@ :organization: `Boost Consulting`_, Indiana University `Open Systems Lab`_, University of Hanover `Institute for Transport Railway Operation and Construction`_ -:date: $Date$ :copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. .. _`Boost Consulting`: http://www.boost-consulting.com diff --git a/doc/iterator_traits.html b/doc/iterator_traits.html index ed892416c..cd510dfd1 100644 --- a/doc/iterator_traits.html +++ b/doc/iterator_traits.html @@ -7,7 +7,6 @@ Iterator Traits - @@ -24,8 +23,6 @@

Iterator Traits

dave@boost-consulting.com Organization: Boost Consulting -Date: -$Date$ Copyright: Copyright David Abrahams 2004. diff --git a/doc/iterator_traits.rst b/doc/iterator_traits.rst index 664001a22..1481bbcbd 100644 --- a/doc/iterator_traits.rst +++ b/doc/iterator_traits.rst @@ -9,7 +9,6 @@ :Author: David Abrahams :Contact: dave@boost-consulting.com :organization: `Boost Consulting`_ -:date: $Date$ :copyright: Copyright David Abrahams 2004. .. _`Boost Consulting`: http://www.boost-consulting.com diff --git a/doc/new-iter-concepts.rst b/doc/new-iter-concepts.rst index bbdf4a23a..27945aeb7 100644 --- a/doc/new-iter-concepts.rst +++ b/doc/new-iter-concepts.rst @@ -13,7 +13,6 @@ :Contact: dave@boost-consulting.com, jsiek@osl.iu.edu, witt@styleadvisor.com :organization: `Boost Consulting`_, Indiana University `Open Systems Lab`_, `Zephyr Associates, Inc.`_ -:date: $Date$ :Number: This is a revised version of n1550_\ =03-0133, which was accepted for Technical Report 1 by the C++ standard diff --git a/doc/permutation_iterator.rst b/doc/permutation_iterator.rst index 0c8070cfa..7af6a3905 100644 --- a/doc/permutation_iterator.rst +++ b/doc/permutation_iterator.rst @@ -10,7 +10,6 @@ :Contact: dave@boost-consulting.com, jsiek@osl.iu.edu :organization: `Boost Consulting`_, Indiana University `Open Systems Lab`_ -:date: $Date$ :copyright: Copyright Toon Knapen, David Abrahams, Roland Richter, and Jeremy Siek 2003. .. _`Boost Consulting`: http://www.boost-consulting.com diff --git a/doc/pointee.rst b/doc/pointee.rst index 993c3d4cb..805644edb 100644 --- a/doc/pointee.rst +++ b/doc/pointee.rst @@ -9,7 +9,6 @@ :Author: David Abrahams :Contact: dave@boost-consulting.com :organization: `Boost Consulting`_ -:date: $Date$ :copyright: Copyright David Abrahams 2004. .. _`Boost Consulting`: http://www.boost-consulting.com diff --git a/doc/ref_problem.rst b/doc/ref_problem.rst index 8dead8942..b0ef30457 100644 --- a/doc/ref_problem.rst +++ b/doc/ref_problem.rst @@ -8,7 +8,6 @@ :Author: David Abrahams and Jeremy Siek :Contact: dave@boost-consulting.com, jsiek@osl.iu.edu :Organization: `Boost Consulting`_, Indiana University Bloomington -:date: $Date$ :Copyright: Copyright David Abrahams, Jeremy Siek 2003. Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy diff --git a/doc/reverse_iterator.rst b/doc/reverse_iterator.rst index e6034b674..ef816d092 100644 --- a/doc/reverse_iterator.rst +++ b/doc/reverse_iterator.rst @@ -11,7 +11,6 @@ :organization: `Boost Consulting`_, Indiana University `Open Systems Lab`_, University of Hanover `Institute for Transport Railway Operation and Construction`_ -:date: $Date$ :copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. .. _`Boost Consulting`: http://www.boost-consulting.com diff --git a/doc/transform_iterator.rst b/doc/transform_iterator.rst index 4f81cca98..cb9f85e05 100644 --- a/doc/transform_iterator.rst +++ b/doc/transform_iterator.rst @@ -11,7 +11,6 @@ :organization: `Boost Consulting`_, Indiana University `Open Systems Lab`_, University of Hanover `Institute for Transport Railway Operation and Construction`_ -:date: $Date$ :copyright: Copyright David Abrahams, Jeremy Siek, and Thomas Witt 2003. .. _`Boost Consulting`: http://www.boost-consulting.com diff --git a/doc/zip_iterator.rst b/doc/zip_iterator.rst index 4e360c34c..928e2fe32 100644 --- a/doc/zip_iterator.rst +++ b/doc/zip_iterator.rst @@ -9,7 +9,6 @@ :Author: David Abrahams, Thomas Becker :Contact: dave@boost-consulting.com, thomas@styleadvisor.com :organization: `Boost Consulting`_, `Zephyr Associates, Inc.`_ -:date: $Date$ :copyright: Copyright David Abrahams and Thomas Becker 2003. .. _`Boost Consulting`: http://www.boost-consulting.com From dfe11e71443edd8e798da50984a8459134dfbc16 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 3 Jan 2024 01:43:52 +0300 Subject: [PATCH 087/173] Removed one more $ tag. --- doc/docutils.sty | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/docutils.sty b/doc/docutils.sty index a6fce3f0a..40e928d8e 100644 --- a/doc/docutils.sty +++ b/doc/docutils.sty @@ -4,7 +4,6 @@ %% %% o author: Alexander Schmolck (a.schmolck@gmx.net) %% o created: 2002-07-07 10:50:31+00:40 -%% o last modified: $Date: 2004/01/29 05:55:26 $ %% o keywords: %% o license: %XXX titlesec From 7968dd3ea88882082270b1c1ce21ebdfc8d3fea9 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 6 Feb 2024 00:17:16 +0300 Subject: [PATCH 088/173] Replaced actions/checkout usage with manual download commands. This fixes the deprecation warnings for actions/checkout@v3. actions/checkout@v4 is not functional because of the upstream bug: https://github.com/actions/checkout/issues/1590 --- .github/workflows/ci.yml | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49fa33528..aeabe905f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -# Copyright 2021-2022 Andrey Semashev +# Copyright 2021-2024 Andrey Semashev # # 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) @@ -321,8 +321,6 @@ jobs: fi git config --global pack.threads 0 - - uses: actions/checkout@v3 - - name: Install packages if: matrix.install run: | @@ -437,11 +435,25 @@ jobs: then DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS") fi + mkdir -p snapshot + cd snapshot + echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz" + curl -L --retry "$NET_RETRY_COUNT" -o "${LIBRARY}-${GITHUB_SHA}.tar.gz" "https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz" + tar -xf "${LIBRARY}-${GITHUB_SHA}.tar.gz" + if [ ! -d "${LIBRARY}-${GITHUB_SHA}" ] + then + echo "Library snapshot does not contain the library directory ${LIBRARY}-${GITHUB_SHA}:" + ls -la + exit 1 + fi + rm -f "${LIBRARY}-${GITHUB_SHA}.tar.gz" cd .. git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root" cd boost-root - mkdir -p libs/$LIBRARY - cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + mkdir -p libs + rm -rf "libs/$LIBRARY" + mv -f "../snapshot/${LIBRARY}-${GITHUB_SHA}" "libs/$LIBRARY" + rm -rf "../snapshot" git submodule update --init tools/boostdep DEPINST_ARGS+=("$LIBRARY") python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" @@ -463,7 +475,7 @@ jobs: - name: Run tests if: matrix.cmake_tests == '' run: | - cd ../boost-root + cd boost-root B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}") if [ -n "${{matrix.build_variant}}" ] then @@ -498,7 +510,7 @@ jobs: then export MACOSX_DEPLOYMENT_TARGET="${{matrix.macosx_version_min}}" fi - cd ../boost-root + cd boost-root mkdir __build_static__ && cd __build_static__ cmake ../libs/$LIBRARY/test/test_cmake cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS From 43dde9b9c34adf57f60b1ffb29d072a1c7cf397e Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 6 Feb 2024 00:22:10 +0300 Subject: [PATCH 089/173] Reduced CI job timeouts. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aeabe905f..9fe0c76d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -292,7 +292,7 @@ jobs: cmake_tests: 1 os: ubuntu-20.04 - timeout-minutes: 60 + timeout-minutes: 20 runs-on: ${{matrix.os}} container: ${{matrix.container}} From 3fa22420829bd9de629672f9e81340706fef29b6 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 6 Feb 2024 00:24:05 +0300 Subject: [PATCH 090/173] Added Windows jobs to GHA CI. --- .github/workflows/ci.yml | 75 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9fe0c76d2..75ab0e9a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -518,3 +518,78 @@ jobs: mkdir __build_shared__ && cd __build_shared__ cmake -DBUILD_SHARED_LIBS=On ../libs/$LIBRARY/test/test_cmake cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS + + windows: + strategy: + fail-fast: false + matrix: + include: + - toolset: msvc-14.0 + cxxstd: "14" + addrmd: 32,64 + os: windows-2019 + - toolset: msvc-14.2 + cxxstd: "14,17,20,latest" + addrmd: 32,64 + os: windows-2019 + - toolset: msvc-14.3 + cxxstd: "14,17,20,latest" + addrmd: 32,64 + os: windows-2022 + - toolset: clang-win + cxxstd: "14,17,latest" + addrmd: 32,64 + os: windows-2022 + - toolset: gcc + cxxstd: "11,14,17,2a" + addrmd: 64 + os: windows-2019 + + timeout-minutes: 20 + runs-on: ${{matrix.os}} + + steps: + - name: Setup Boost + shell: cmd + run: | + echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY% + for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi + echo LIBRARY: %LIBRARY% + echo LIBRARY=%LIBRARY%>>%GITHUB_ENV% + echo GITHUB_BASE_REF: %GITHUB_BASE_REF% + echo GITHUB_REF: %GITHUB_REF% + if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF% + set BOOST_BRANCH=develop + for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master + echo BOOST_BRANCH: %BOOST_BRANCH% + mkdir snapshot + cd snapshot + echo Downloading library snapshot: https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip + curl -L --retry %NET_RETRY_COUNT% -o "%LIBRARY%-%GITHUB_SHA%.zip" "https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip" + tar -xf "%LIBRARY%-%GITHUB_SHA%.zip" + if not exist "%LIBRARY%-%GITHUB_SHA%\" ( + echo Library snapshot does not contain the library directory %LIBRARY%-%GITHUB_SHA%: + dir + exit /b 1 + ) + del /f "%LIBRARY%-%GITHUB_SHA%.zip" + cd .. + git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + if not exist "libs\" mkdir libs + if exist "libs\%LIBRARY%\" rmdir /s /q "libs\%LIBRARY%" + move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%" + rmdir /s /q "..\snapshot" + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY% + cmd /c bootstrap + b2 -d0 headers + + - name: Run tests + shell: cmd + run: | + cd boost-root + if not "${{matrix.cxxstd}}" == "" set CXXSTD=cxxstd=${{matrix.cxxstd}} + if not "${{matrix.addrmd}}" == "" set ADDRMD=address-model=${{matrix.addrmd}} + if not "${{matrix.build_variant}}" == "" (set BUILD_VARIANT=variant=${{matrix.build_variant}}) else (set BUILD_VARIANT=variant=%DEFAULT_BUILD_VARIANT%) + b2 -j %NUMBER_OF_PROCESSORS% libs/%LIBRARY%/test toolset=${{matrix.toolset}} %CXXSTD% %ADDRMD% %BUILD_VARIANT% embed-manifest-via=linker From 988594fb9d89de13f8cf5b99658a2ff14b4fb2d7 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 6 Feb 2024 00:26:38 +0300 Subject: [PATCH 091/173] Added clang-17 CI jobs. --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75ab0e9a2..b400071e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -270,6 +270,30 @@ jobs: - "https://apt.llvm.org/llvm-snapshot.gpg.key" cxxflags: -stdlib=libc++ linkflags: -stdlib=libc++ + - toolset: clang + compiler: clang++-17 + cxxstd: "11,14,17,20,23" + os: ubuntu-22.04 + install: + - clang-17 + sources: + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" + source_keys: + - "https://apt.llvm.org/llvm-snapshot.gpg.key" + - toolset: clang + compiler: clang++-17 + cxxstd: "11,14,17,20,23" + os: ubuntu-22.04 + install: + - clang-17 + - libc++-17-dev + - libc++abi-17-dev + sources: + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" + source_keys: + - "https://apt.llvm.org/llvm-snapshot.gpg.key" + cxxflags: -stdlib=libc++ + linkflags: -stdlib=libc++ - name: UBSAN toolset: clang compiler: clang++-15 From 4f7219965a399051bb0d8088ea4ab3929b1ac3f2 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 6 Feb 2024 00:35:15 +0300 Subject: [PATCH 092/173] Added gcc-13 CI job. --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b400071e0..660d30b15 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,6 +103,12 @@ jobs: os: ubuntu-22.04 install: - g++-12 + - toolset: gcc-13 + cxxstd: "11,14,17,20,23" + os: ubuntu-latest + container: ubuntu:23.04 + install: + - g++-13 - name: UBSAN toolset: gcc-11 cxxstd: "11,14,17,20,23" From 0abef890ee04f041db43c381b1f8126ffa411bb1 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 21 May 2024 01:17:20 +0300 Subject: [PATCH 093/173] Replaced macos-11 GHA image with 12, 13 and 14 since 11 is being removed. --- .github/workflows/ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 660d30b15..3cbb038f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -315,8 +315,14 @@ jobs: - libc++abi-15-dev - toolset: clang - cxxstd: "11,14,17,2a" - os: macos-11 + cxxstd: "11,14,17,20,2b" + os: macos-12 + - toolset: clang + cxxstd: "11,14,17,20,2b" + os: macos-13 + - toolset: clang + cxxstd: "11,14,17,20,2b" + os: macos-14 - name: CMake tests cmake_tests: 1 From 4914e1f40abf6ba1e6e2ad196cdac557b0783cf3 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 3 Jul 2024 15:12:28 +0300 Subject: [PATCH 094/173] Updated deprecated include in docs. Closes https://github.com/boostorg/iterator/pull/83. --- doc/facade-and-adaptor.html | 2 +- doc/func_output_iter_ref.rst | 2 +- doc/function_output_iterator.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/facade-and-adaptor.html b/doc/facade-and-adaptor.html index 79d38a30a..db51147c7 100644 --- a/doc/facade-and-adaptor.html +++ b/doc/facade-and-adaptor.html @@ -2622,7 +2622,7 @@

Class template

Header

-#include <boost/function_output_iterator.hpp>
+#include <boost/iterator/function_output_iterator.hpp>
 
 template <class UnaryFunction>
diff --git a/doc/func_output_iter_ref.rst b/doc/func_output_iter_ref.rst
index e00eab751..92854ff9c 100644
--- a/doc/func_output_iter_ref.rst
+++ b/doc/func_output_iter_ref.rst
@@ -7,7 +7,7 @@ Header
 
 ::
   
-  #include 
+  #include 
 
 ::
 
diff --git a/doc/function_output_iterator.html b/doc/function_output_iterator.html
index 1bae71b86..7eaa81cf0 100644
--- a/doc/function_output_iterator.html
+++ b/doc/function_output_iterator.html
@@ -68,7 +68,7 @@ 

Function Output Iterator