Compare commits

...

19 Commits

Author SHA1 Message Date
814965402e Merge pull request #49 from glenfe/develop
Use use_default from Boost.Core
2019-02-22 20:44:56 -05:00
2af5a16539 Use use_default from Boost.Core
boost::use_default is now defined in Core for multiple Boost libraries.
2019-02-22 17:17:52 -05:00
171c716d03 Enabled multiple git fetch jobs while executing depinst in CI. Increased the number of jobs to 8. 2019-01-15 13:54:52 +03:00
398fe907d0 Use the actual number of logical CPUs for the number of CI build/test jobs. 2019-01-03 23:19:41 +03:00
e31ae13df5 Re-added manual checkout of libs/config in CI as Boost.Build depends on it. 2018-12-20 20:46:10 +03:00
02e74bf26a Use multiple jobs to checkout submodules in parallel in CI. 2018-12-18 22:34:58 +03:00
20b5a9c11a Added tools/boost_install and libs/headers manual checkout to CI jobs. 2018-12-18 22:05:56 +03:00
73918b8616 Added an experimental partial CMakeLists.txt for dependency tracking in CMake projects. 2018-12-18 19:49:23 +03:00
bb1efd3370 Updated addressof.hpp include path. 2018-11-14 12:42:24 +03:00
3cc4107d01 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).
2018-09-23 12:37:21 +03:00
6ab148be01 Revert "Revert "Replace using-declarations with using-directives to avoid ADL issues.""
This reverts commit 06875a754d.

The suggested fix for build failures need to be applied to Boost.Range:

https://github.com/boostorg/range/pull/75
2018-09-23 12:28:03 +03:00
06875a754d Revert "Replace using-declarations with using-directives to avoid ADL issues."
This reverts commit 44cee00831.

The commit reportedly broke building Boost and quickbook.

b844c8df53 (commitcomment-30603668)
2018-09-22 18:46:36 +03:00
b844c8df53 Merge pull request #44 from morinmorin/fix/unwanted_adl
Fix #43 (unwanted ADL issues)
2018-09-22 16:05:22 +03:00
194087e8ca Merge branch 'develop' into fix/unwanted_adl 2018-09-22 20:47:10 +09:00
b5edc8b64f Add test for ADL issues. 2018-09-22 20:44:29 +09:00
44cee00831 Replace using-declarations with using-directives to avoid ADL issues. 2018-09-22 20:20:59 +09:00
b2adecb951 Merge pull request #40 from DanielaE/fix/no-iterator-inheritance
Inheriting std::iterator is deprecated in c++17.
2017-12-28 18:43:47 -05:00
e16f2de233 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 <dani@ngrt.de>
2017-12-27 09:32:51 +01:00
218dc4baf1 Merge branch 'feature/move-shared-iterator' into develop 2017-12-24 14:23:54 +02:00
15 changed files with 180 additions and 62 deletions

View File

@ -67,20 +67,26 @@ matrix:
env: TOOLSET=clang CXXSTD=03,11,14,1z
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- 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 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 init libs/config
- 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
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:

34
CMakeLists.txt Normal file
View File

@ -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
)

View File

@ -23,16 +23,20 @@ environment:
CXXSTD: 14,17
install:
- set GIT_FETCH_JOBS=8
- set BOOST_BRANCH=develop
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
- 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 init libs/config
- 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
@ -40,4 +44,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%

View File

@ -77,7 +77,7 @@ namespace iterators {
} // namespace iterators
using iterators::advance;
using namespace iterators::advance_adl_barrier;
} // namespace boost

View File

@ -4,6 +4,8 @@
#ifndef FACADE_ITERATOR_CATEGORY_DWA20031118_HPP
# define FACADE_ITERATOR_CATEGORY_DWA20031118_HPP
# include <boost/core/use_default.hpp>
# include <boost/iterator/iterator_categories.hpp>
# include <boost/mpl/or.hpp> // 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 {

View File

@ -58,7 +58,7 @@ namespace iterators {
} // namespace iterators
using iterators::distance;
using namespace iterators::distance_adl_barrier;
} // namespace boost

View File

@ -9,6 +9,8 @@
#include <boost/static_assert.hpp>
#include <boost/core/use_default.hpp>
#include <boost/iterator/iterator_categories.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/detail/enable_if.hpp>
@ -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.

View File

@ -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;
};
};
}

View File

@ -16,7 +16,7 @@
#include <boost/iterator/detail/enable_if.hpp>
#include <boost/static_assert.hpp>
#include <boost/utility/addressof.hpp>
#include <boost/core/addressof.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/add_const.hpp>

View File

@ -59,6 +59,8 @@ test-suite iterator
[ run next_prior_test.cpp ]
[ run advance_test.cpp ]
[ run distance_test.cpp ]
[ compile adl_test.cpp ]
[ compile range_distance_compat_test.cpp ]
[ run shared_iterator_test.cpp ]
;

25
test/adl_test.cpp Normal file
View File

@ -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 <vector>
#include <boost/array.hpp>
#include <boost/iterator/advance.hpp>
#include <boost/iterator/distance.hpp>
int main()
{
// Test that boost::advance/distance are not found by ADL.
// (https://github.com/boostorg/iterator/issues/43)
typedef boost::array<int, 1> boost_type;
std::vector<boost_type> std_boost(2);
std::vector<boost_type>::iterator it = std_boost.begin();
advance(it, 2);
(void)distance(it, it);
return 0;
}

View File

@ -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<std::random_access_iterator_tag, int>
{
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; }

View File

@ -5,10 +5,10 @@
#include <deque>
#include <iterator>
#include <iostream>
#include <cstddef> // std::ptrdiff_t
#include <boost/static_assert.hpp>
#include <boost/noncopyable.hpp>
#include <boost/iterator/is_lvalue_iterator.hpp>
#include <boost/iterator.hpp>
// Last, for BOOST_NO_LVALUE_RETURN_DETECTION
#include <boost/iterator/detail/config_def.hpp>
@ -20,29 +20,36 @@ struct v
};
struct value_iterator : boost::iterator<std::input_iterator_tag,v>
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<std::forward_iterator_tag,boost::noncopyable>
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 <class T>
struct proxy_iterator
: boost::iterator<std::output_iterator_tag,T>
{
typedef T value_type;
#if BOOST_WORKAROUND(__GNUC__, == 2)
typedef boost::iterator<std::input_iterator_tag,value_type> 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
{

View File

@ -5,10 +5,10 @@
#include <deque>
#include <iterator>
#include <iostream>
#include <cstddef> // std::ptrdiff_t
#include <boost/static_assert.hpp>
#include <boost/noncopyable.hpp>
#include <boost/iterator/is_readable_iterator.hpp>
#include <boost/iterator.hpp>
// Last, for BOOST_NO_LVALUE_RETURN_DETECTION
#include <boost/iterator/detail/config_def.hpp>
@ -20,26 +20,35 @@ struct v
};
struct value_iterator : boost::iterator<std::input_iterator_tag,v>
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<std::forward_iterator_tag,boost::noncopyable>
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<std::output_iterator_tag,v>
struct proxy_iterator
{
#if BOOST_WORKAROUND(__GNUC__, == 2)
typedef boost::iterator<std::input_iterator_tag,v> 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<std::output_iterator_tag,v>
proxy operator*() const;
};
struct proxy_iterator2 : boost::iterator<std::output_iterator_tag,v>
struct proxy_iterator2
{
#if BOOST_WORKAROUND(__GNUC__, == 2)
typedef boost::iterator<std::input_iterator_tag,v> 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
{

View File

@ -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 <boost/range/distance.hpp>
#include <boost/range/iterator_range_core.hpp>
#include <boost/iterator/distance.hpp>
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<const char*> range_type;
range_type range;
(void)boost::distance(range);
return 0;
}