mirror of
https://github.com/boostorg/iterator.git
synced 2025-07-03 07:46:41 +02:00
Compare commits
19 Commits
feature/mo
...
boost-1.70
Author | SHA1 | Date | |
---|---|---|---|
814965402e | |||
2af5a16539 | |||
171c716d03 | |||
398fe907d0 | |||
e31ae13df5 | |||
02e74bf26a | |||
20b5a9c11a | |||
73918b8616 | |||
bb1efd3370 | |||
3cc4107d01 | |||
6ab148be01 | |||
06875a754d | |||
b844c8df53 | |||
194087e8ca | |||
b5edc8b64f | |||
44cee00831 | |||
b2adecb951 | |||
e16f2de233 | |||
218dc4baf1 |
18
.travis.yml
18
.travis.yml
@ -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
34
CMakeLists.txt
Normal 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
|
||||
)
|
14
appveyor.yml
14
appveyor.yml
@ -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%
|
||||
|
@ -77,7 +77,7 @@ namespace iterators {
|
||||
|
||||
} // namespace iterators
|
||||
|
||||
using iterators::advance;
|
||||
using namespace iterators::advance_adl_barrier;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -58,7 +58,7 @@ namespace iterators {
|
||||
|
||||
} // namespace iterators
|
||||
|
||||
using iterators::distance;
|
||||
using namespace iterators::distance_adl_barrier;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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
25
test/adl_test.cpp
Normal 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;
|
||||
}
|
@ -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; }
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
{
|
||||
|
22
test/range_distance_compat_test.cpp
Normal file
22
test/range_distance_compat_test.cpp
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user