mirror of
https://github.com/boostorg/iterator.git
synced 2025-12-26 16:58:12 +01:00
Compare commits
18 Commits
boost-1.88
...
boost-1.90
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a4dbd1d8d | ||
|
|
e16399b613 | ||
|
|
ecf4ed8bf5 | ||
|
|
248494330d | ||
|
|
ca0e772d2a | ||
|
|
2a0b753691 | ||
|
|
0087a426d9 | ||
|
|
c409288ff5 | ||
|
|
01ac4e1a47 | ||
|
|
e968c3312b | ||
|
|
da00617e56 | ||
|
|
7c77e52509 | ||
|
|
256004a446 | ||
|
|
7e3e9a584e | ||
|
|
3767696513 | ||
|
|
1372e9afb6 | ||
|
|
6428e552e4 | ||
|
|
766c881f9a |
89
.github/workflows/ci.yml
vendored
89
.github/workflows/ci.yml
vendored
@@ -33,18 +33,6 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
# Linux, gcc
|
||||
- toolset: gcc-4.8
|
||||
cxxstd: "11"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:18.04
|
||||
install:
|
||||
- g++-4.8
|
||||
- toolset: gcc-4.9
|
||||
cxxstd: "11"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:16.04
|
||||
install:
|
||||
- g++-4.9
|
||||
- toolset: gcc-5
|
||||
cxxstd: "11,14,1z"
|
||||
os: ubuntu-latest
|
||||
@@ -71,12 +59,14 @@ jobs:
|
||||
- g++-8
|
||||
- toolset: gcc-9
|
||||
cxxstd: "11,14,17,2a"
|
||||
os: ubuntu-20.04
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:20.04
|
||||
install:
|
||||
- g++-9
|
||||
- toolset: gcc-10
|
||||
cxxstd: "11,14,17,20"
|
||||
os: ubuntu-20.04
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:20.04
|
||||
install:
|
||||
- g++-10
|
||||
- toolset: gcc-11
|
||||
@@ -99,6 +89,12 @@ jobs:
|
||||
os: ubuntu-24.04
|
||||
install:
|
||||
- g++-14
|
||||
- toolset: gcc-15
|
||||
cxxstd: "11,14,17,20,23,26"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:25.04
|
||||
install:
|
||||
- g++-15
|
||||
- name: UBSAN
|
||||
toolset: gcc-13
|
||||
cxxstd: "11,14,17,20,23"
|
||||
@@ -185,13 +181,15 @@ jobs:
|
||||
- toolset: clang
|
||||
compiler: clang++-9
|
||||
cxxstd: "11,14,17,2a"
|
||||
os: ubuntu-20.04
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:20.04
|
||||
install:
|
||||
- clang-9
|
||||
- toolset: clang
|
||||
compiler: clang++-10
|
||||
cxxstd: "11,14,17,20"
|
||||
os: ubuntu-20.04
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:20.04
|
||||
install:
|
||||
- clang-10
|
||||
- toolset: clang
|
||||
@@ -263,22 +261,22 @@ jobs:
|
||||
os: ubuntu-24.04
|
||||
install:
|
||||
- clang-19
|
||||
sources:
|
||||
- "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main"
|
||||
source_keys:
|
||||
- "https://apt.llvm.org/llvm-snapshot.gpg.key"
|
||||
- toolset: clang
|
||||
compiler: clang++-19
|
||||
compiler: clang++-20
|
||||
cxxstd: "11,14,17,20,23,26"
|
||||
os: ubuntu-24.04
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:25.04
|
||||
install:
|
||||
- clang-19
|
||||
- libc++-19-dev
|
||||
- libc++abi-19-dev
|
||||
sources:
|
||||
- "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main"
|
||||
source_keys:
|
||||
- "https://apt.llvm.org/llvm-snapshot.gpg.key"
|
||||
- clang-20
|
||||
- toolset: clang
|
||||
compiler: clang++-20
|
||||
cxxstd: "11,14,17,20,23,26"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:25.04
|
||||
install:
|
||||
- clang-20
|
||||
- libc++-20-dev
|
||||
- libc++abi-20-dev
|
||||
cxxflags: -stdlib=libc++
|
||||
linkflags: -stdlib=libc++
|
||||
- name: UBSAN
|
||||
@@ -295,9 +293,6 @@ jobs:
|
||||
- libc++-18-dev
|
||||
- libc++abi-18-dev
|
||||
|
||||
- toolset: clang
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
os: macos-13
|
||||
- toolset: clang
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
os: macos-14
|
||||
@@ -307,7 +302,7 @@ jobs:
|
||||
|
||||
- name: CMake tests
|
||||
cmake_tests: 1
|
||||
os: ubuntu-20.04
|
||||
os: ubuntu-24.04
|
||||
|
||||
timeout-minutes: 20
|
||||
runs-on: ${{matrix.os}}
|
||||
@@ -326,6 +321,22 @@ jobs:
|
||||
echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV
|
||||
if [ -f "/etc/debian_version" ]
|
||||
then
|
||||
# Use Azure APT mirrors in containers to avoid HTTP errors due to DDoS filters triggered by lots of CI jobs launching concurrently.
|
||||
# Note that not all Ubuntu versions support "mirror+file:..." URIs in APT sources, so just use Azure mirrors exclusively.
|
||||
# Note also that on recent Ubuntu versions DEB822 format is used for source files.
|
||||
APT_SOURCES=()
|
||||
if [ -d "/etc/apt/sources.list.d" ]
|
||||
then
|
||||
readarray -t APT_SOURCES < <(find "/etc/apt/sources.list.d" -type f -name '*.sources' -print)
|
||||
fi
|
||||
if [ -f "/etc/apt/sources.list" ]
|
||||
then
|
||||
APT_SOURCES+=("/etc/apt/sources.list")
|
||||
fi
|
||||
if [ "${#APT_SOURCES[@]}" -gt 0 ]
|
||||
then
|
||||
sed -i -E -e 's!([^ ]+) (http|https)://(archive|security)\.ubuntu\.com/ubuntu[^ ]*(.*)!\1 http://azure.archive.ubuntu.com/ubuntu/\4!' "${APT_SOURCES[@]}"
|
||||
fi
|
||||
apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
|
||||
if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ]
|
||||
then
|
||||
@@ -545,14 +556,6 @@ jobs:
|
||||
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
|
||||
@@ -562,9 +565,9 @@ jobs:
|
||||
addrmd: 32,64
|
||||
os: windows-2022
|
||||
- toolset: gcc
|
||||
cxxstd: "11,14,17,2a"
|
||||
cxxstd: "11,14,17,20,23"
|
||||
addrmd: 64
|
||||
os: windows-2019
|
||||
os: windows-2022
|
||||
|
||||
timeout-minutes: 20
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
@@ -19,8 +19,8 @@ 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) | [](https://github.com/boostorg/iterator/actions?query=branch%3Amaster) | [](https://ci.appveyor.com/project/Lastique/iterator/branch/master) | [](http://www.boost.org/development/tests/master/developer/iterator.html) | [](https://pdimov.github.io/boostdep-report/master/iterator.html)
|
||||
[`develop`](https://github.com/boostorg/iterator/tree/develop) | [](https://github.com/boostorg/iterator/actions?query=branch%3Adevelop) | [](https://ci.appveyor.com/project/Lastique/iterator/branch/develop) | [](http://www.boost.org/development/tests/develop/developer/iterator.html) | [](https://pdimov.github.io/boostdep-report/develop/iterator.html)
|
||||
[`master`](https://github.com/boostorg/iterator/tree/master) | [](https://github.com/boostorg/iterator/actions?query=branch%3Amaster) | [](https://ci.appveyor.com/project/Lastique/iterator/branch/master) | [](https://regression.boost.io/master/developer/iterator.html) | [](https://pdimov.github.io/boostdep-report/master/iterator.html)
|
||||
[`develop`](https://github.com/boostorg/iterator/tree/develop) | [](https://github.com/boostorg/iterator/actions?query=branch%3Adevelop) | [](https://ci.appveyor.com/project/Lastique/iterator/branch/develop) | [](https://regression.boost.io/develop/developer/iterator.html) | [](https://pdimov.github.io/boostdep-report/develop/iterator.html)
|
||||
|
||||
### License
|
||||
|
||||
|
||||
15
appveyor.yml
15
appveyor.yml
@@ -32,9 +32,15 @@ environment:
|
||||
CXXSTD: 14,17,20,latest
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
|
||||
- TOOLSET: clang-win
|
||||
ADDRMD: 32,64
|
||||
ADDRMD: 32
|
||||
CXXSTD: 14,17,latest
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
ENV_SCRIPT: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
- TOOLSET: clang-win
|
||||
ADDRMD: 64
|
||||
CXXSTD: 14,17,latest
|
||||
ENV_SCRIPT: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
- TOOLSET: gcc
|
||||
CXXSTD: 11,14,1z
|
||||
ADDPATH: C:\cygwin\bin;
|
||||
@@ -43,10 +49,6 @@ environment:
|
||||
CXXSTD: 11,14,1z
|
||||
ADDPATH: C:\cygwin64\bin;
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
- TOOLSET: gcc
|
||||
CXXSTD: 11,14,1z
|
||||
ADDPATH: C:\mingw\bin;
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
- TOOLSET: gcc
|
||||
CXXSTD: 11,14,1z
|
||||
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;
|
||||
@@ -80,6 +82,7 @@ build: off
|
||||
|
||||
test_script:
|
||||
- PATH=%ADDPATH%%PATH%
|
||||
- if not "%ENV_SCRIPT%" == "" call "%ENV_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%
|
||||
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
|
||||
template< typename OtherIterator, typename = enable_if_convertible_t< OtherIterator, Iterator > >
|
||||
filter_iterator(filter_iterator< Predicate, OtherIterator > const& t) :
|
||||
super_t(t.base()), m_storage(t.m_storage.predicate(), m_storage.m_end)
|
||||
super_t(t.base()), m_storage(t.m_storage.predicate(), t.m_storage.m_end)
|
||||
{}
|
||||
|
||||
Predicate predicate() const { return m_storage.predicate(); }
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
@@ -346,63 +347,52 @@ class operator_brackets_proxy
|
||||
// Iterator is actually an iterator_facade, so we do not have to
|
||||
// go through iterator_traits to access the traits.
|
||||
using reference = typename Iterator::reference;
|
||||
using value_type = typename Iterator::value_type;
|
||||
|
||||
public:
|
||||
operator_brackets_proxy(Iterator const& iter) :
|
||||
explicit operator_brackets_proxy(Iterator const& iter) noexcept(std::is_nothrow_copy_constructible< Iterator >::value) :
|
||||
m_iter(iter)
|
||||
{}
|
||||
|
||||
operator reference() const
|
||||
operator reference() const noexcept(noexcept(*std::declval< Iterator const& >()))
|
||||
{
|
||||
return *m_iter;
|
||||
}
|
||||
|
||||
operator_brackets_proxy& operator=(value_type const& val)
|
||||
template< typename T >
|
||||
typename std::enable_if<
|
||||
detail::conjunction<
|
||||
detail::negation<
|
||||
std::is_same<
|
||||
operator_brackets_proxy< Iterator >,
|
||||
typename std::remove_cv< typename std::remove_reference< T >::type >::type
|
||||
>
|
||||
>,
|
||||
std::is_assignable< reference, T&& >
|
||||
>::value,
|
||||
operator_brackets_proxy&
|
||||
>::type operator= (T&& val) noexcept(noexcept(*std::declval< Iterator& >() = std::declval< T&& >()))
|
||||
{
|
||||
*m_iter = val;
|
||||
*m_iter = static_cast< T&& >(val);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Provides it[n]->foo(). Leverages chaining of operator->.
|
||||
reference operator->() const noexcept(noexcept(*std::declval< Iterator const& >()))
|
||||
{
|
||||
return *m_iter;
|
||||
}
|
||||
|
||||
// Provides (*it[n]).foo()
|
||||
template< typename Ref = reference, typename Result = decltype(*std::declval< Ref >()) >
|
||||
Result operator*() const noexcept(noexcept(**std::declval< Iterator const& >()))
|
||||
{
|
||||
return **m_iter;
|
||||
}
|
||||
|
||||
private:
|
||||
Iterator m_iter;
|
||||
};
|
||||
|
||||
// A metafunction that determines whether operator[] must return a
|
||||
// proxy, or whether it can simply return a copy of the value_type.
|
||||
template< typename ValueType, typename Reference >
|
||||
struct use_operator_brackets_proxy :
|
||||
public detail::negation<
|
||||
detail::conjunction<
|
||||
std::is_copy_constructible< ValueType >,
|
||||
std::is_trivial< ValueType >,
|
||||
iterator_writability_disabled< ValueType, Reference >
|
||||
>
|
||||
>
|
||||
{};
|
||||
|
||||
template< typename Iterator, typename Value, typename Reference >
|
||||
struct operator_brackets_result
|
||||
{
|
||||
using type = typename std::conditional<
|
||||
use_operator_brackets_proxy<Value, Reference>::value,
|
||||
operator_brackets_proxy<Iterator>,
|
||||
Value
|
||||
>::type;
|
||||
};
|
||||
|
||||
template< typename Iterator >
|
||||
inline operator_brackets_proxy<Iterator> make_operator_brackets_result(Iterator const& iter, std::true_type)
|
||||
{
|
||||
return operator_brackets_proxy< Iterator >(iter);
|
||||
}
|
||||
|
||||
template< typename Iterator >
|
||||
inline typename Iterator::value_type make_operator_brackets_result(Iterator const& iter, std::false_type)
|
||||
{
|
||||
return *iter;
|
||||
}
|
||||
|
||||
// A binary metafunction class that always returns bool.
|
||||
template< typename Iterator1, typename Iterator2 >
|
||||
using always_bool_t = bool;
|
||||
@@ -679,13 +669,9 @@ public:
|
||||
using difference_type = typename base_type::difference_type;
|
||||
|
||||
public:
|
||||
typename boost::iterators::detail::operator_brackets_result< Derived, Value, reference >::type
|
||||
operator[](difference_type n) const
|
||||
operator_brackets_proxy< Derived > operator[](difference_type n) const
|
||||
{
|
||||
return boost::iterators::detail::make_operator_brackets_result< Derived >(
|
||||
this->derived() + n,
|
||||
std::integral_constant< bool, boost::iterators::detail::use_operator_brackets_proxy< Value, Reference >::value >{}
|
||||
);
|
||||
return operator_brackets_proxy< Derived >(this->derived() + n);
|
||||
}
|
||||
|
||||
Derived& operator+=(difference_type n)
|
||||
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
std::remove_reference< reference >
|
||||
>;
|
||||
|
||||
public:
|
||||
public:
|
||||
using type = iterator_adaptor<
|
||||
transform_iterator< UnaryFunc, Iterator, Reference, Value >,
|
||||
Iterator,
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
"Thomas Witt <witt - at - acm.org>",
|
||||
"Jeffrey Lee Hellrung Jr. <jeffrey.hellrung -at- gmail.com>"
|
||||
],
|
||||
"cxxstd": "03"
|
||||
"cxxstd": "11"
|
||||
}
|
||||
|
||||
@@ -189,6 +189,16 @@ main()
|
||||
boost::const_nonconst_iterator_test(i, ++j);
|
||||
}
|
||||
|
||||
// Test that operator_brackets_proxy forwards operator-> and operator*
|
||||
{
|
||||
dummyT* ptr_array[] = { array + 0, array + 1, array + 2,
|
||||
array + 3, array + 4, array + 5 };
|
||||
|
||||
ptr_iterator<dummyT*> i(ptr_array);
|
||||
BOOST_TEST_EQ(i[2]->foo(), 2);
|
||||
BOOST_TEST_EQ((*i[2]).foo(), 2);
|
||||
}
|
||||
|
||||
int test;
|
||||
// Test the iterator_traits
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user