forked from boostorg/iterator
Compare commits
10 Commits
boost-1.82
...
develop
Author | SHA1 | Date | |
---|---|---|---|
ae5d7d8c0c | |||
d72d57fa39 | |||
c98f965388 | |||
d09f78ae9b | |||
a9dabd3c65 | |||
80bb1ac9e4 | |||
d11499c08c | |||
6d02c36718 | |||
85b542e1b6 | |||
e8fbd92a61 |
136
.github/workflows/ci.yml
vendored
136
.github/workflows/ci.yml
vendored
@ -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,82 +188,110 @@ 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
|
||||
- g++-11
|
||||
gcc_toolchain: 11
|
||||
- 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
|
||||
- g++-11
|
||||
gcc_toolchain: 11
|
||||
- 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
|
||||
- g++-11
|
||||
gcc_toolchain: 11
|
||||
- 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
|
||||
sources:
|
||||
- "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main"
|
||||
source_keys:
|
||||
- "https://apt.llvm.org/llvm-snapshot.gpg.key"
|
||||
- g++-11
|
||||
gcc_toolchain: 11
|
||||
- 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
|
||||
- libc++-15-dev
|
||||
- libc++abi-15-dev
|
||||
cxxflags: -stdlib=libc++
|
||||
linkflags: -stdlib=libc++
|
||||
- toolset: clang
|
||||
compiler: clang++-16
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
os: ubuntu-22.04
|
||||
install:
|
||||
- clang-16
|
||||
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"
|
||||
- toolset: clang
|
||||
compiler: clang++-16
|
||||
cxxstd: "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-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
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
compiler: clang++-15
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
cxxflags: -stdlib=libc++
|
||||
linkflags: -stdlib=libc++
|
||||
ubsan: 1
|
||||
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"
|
||||
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}}
|
||||
@ -470,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
|
||||
|
@ -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
|
||||
|
29
appveyor.yml
29
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,25 +39,27 @@ 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
|
||||
- TEST_CMAKE: 1
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
|
||||
install:
|
||||
- set GIT_FETCH_JOBS=8
|
||||
@ -87,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%
|
||||
|
@ -13,15 +13,14 @@
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/mpl/eval_if.hpp>
|
||||
# include <boost/mpl/identity.hpp>
|
||||
# include <boost/mpl/assert.hpp>
|
||||
|
||||
# include <boost/static_assert.hpp>
|
||||
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
# include <boost/type_traits/is_const.hpp>
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
|
||||
# include <boost/iterator/detail/config_def.hpp> // 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<Category>::type
|
||||
, Traversal
|
||||
>));
|
||||
>::value));
|
||||
|
||||
BOOST_MPL_ASSERT((is_iterator_category<Category>));
|
||||
BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>));
|
||||
BOOST_MPL_ASSERT_NOT((is_iterator_traversal<Category>));
|
||||
BOOST_STATIC_ASSERT(is_iterator_category<Category>::value);
|
||||
BOOST_STATIC_ASSERT(!is_iterator_category<Traversal>::value);
|
||||
BOOST_STATIC_ASSERT(!is_iterator_traversal<Category>::value);
|
||||
# if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
|
||||
BOOST_MPL_ASSERT((is_iterator_traversal<Traversal>));
|
||||
BOOST_STATIC_ASSERT(is_iterator_traversal<Traversal>::value);
|
||||
# endif
|
||||
};
|
||||
|
||||
@ -158,7 +157,7 @@ struct iterator_category_with_traversal
|
||||
template <class Traversal, class ValueParam, class Reference>
|
||||
struct facade_iterator_category_impl
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((is_iterator_category<Traversal>));
|
||||
BOOST_STATIC_ASSERT(!is_iterator_category<Traversal>::value);
|
||||
|
||||
typedef typename iterator_facade_default_category<
|
||||
Traversal,ValueParam,Reference
|
||||
|
@ -12,6 +12,14 @@
|
||||
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#define BOOST_ITERATOR_DETAIL_MOVE(_type, _value) static_cast< _type&& >(_value)
|
||||
#else
|
||||
#define BOOST_ITERATOR_DETAIL_MOVE(_type, _value) _value
|
||||
#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(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(x), m_predicate(), m_end(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.
|
||||
@ -111,7 +119,7 @@ namespace iterators {
|
||||
inline filter_iterator<Predicate,Iterator>
|
||||
make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator())
|
||||
{
|
||||
return filter_iterator<Predicate,Iterator>(f,x,end);
|
||||
return filter_iterator<Predicate,Iterator>(BOOST_ITERATOR_DETAIL_MOVE(Predicate, f), BOOST_ITERATOR_DETAIL_MOVE(Iterator, x), BOOST_ITERATOR_DETAIL_MOVE(Iterator, end));
|
||||
}
|
||||
|
||||
template <class Predicate, class Iterator>
|
||||
@ -123,7 +131,7 @@ namespace iterators {
|
||||
>::type x
|
||||
, Iterator end = Iterator())
|
||||
{
|
||||
return filter_iterator<Predicate,Iterator>(x,end);
|
||||
return filter_iterator<Predicate,Iterator>(BOOST_ITERATOR_DETAIL_MOVE(Iterator, x), BOOST_ITERATOR_DETAIL_MOVE(Iterator, 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
|
||||
|
148
include/boost/iterator/is_iterator.hpp
Normal file
148
include/boost/iterator/is_iterator.hpp
Normal file
@ -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 <cstddef>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#include <boost/type_traits/negation.hpp>
|
||||
#include <boost/type_traits/conjunction.hpp>
|
||||
#include <boost/type_traits/is_complete.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
#if !defined(BOOST_NO_CXX17_ITERATOR_TRAITS)
|
||||
#include <iterator>
|
||||
#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<T>::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_
|
@ -144,8 +144,8 @@ namespace boost_concepts
|
||||
{
|
||||
typedef typename std::iterator_traits<Iterator>::difference_type difference_type;
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_integral<difference_type>));
|
||||
BOOST_MPL_ASSERT_RELATION(std::numeric_limits<difference_type>::is_signed, ==, true);
|
||||
BOOST_STATIC_ASSERT(boost::is_integral<difference_type>::value);
|
||||
BOOST_STATIC_ASSERT(std::numeric_limits<difference_type>::is_signed);
|
||||
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
boost::Convertible<
|
||||
|
@ -15,13 +15,12 @@
|
||||
#ifndef BOOST_NEXT_PRIOR_HPP_INCLUDED
|
||||
#define BOOST_NEXT_PRIOR_HPP_INCLUDED
|
||||
|
||||
#include <iterator>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/type_traits/has_plus.hpp>
|
||||
#include <boost/type_traits/has_plus_assign.hpp>
|
||||
#include <boost/type_traits/has_minus.hpp>
|
||||
#include <boost/type_traits/has_minus_assign.hpp>
|
||||
#include <boost/iterator/is_iterator.hpp>
|
||||
#include <boost/iterator/advance.hpp>
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
|
||||
@ -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<T>::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 >
|
||||
{
|
||||
|
@ -22,7 +22,6 @@
|
||||
# include <iterator>
|
||||
# include <boost/static_assert.hpp>
|
||||
# include <boost/concept_archetype.hpp> // for detail::dummy_constructor
|
||||
# include <boost/implicit_cast.hpp>
|
||||
# include <boost/core/ignore_unused.hpp>
|
||||
# include <boost/core/lightweight_test.hpp>
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
@ -223,12 +222,15 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals)
|
||||
int c;
|
||||
|
||||
typedef typename std::iterator_traits<Iterator>::value_type value_type;
|
||||
boost::ignore_unused<value_type>();
|
||||
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<value_type>(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<value_type>(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);
|
||||
|
@ -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 ]
|
||||
|
164
test/is_iterator.cpp
Normal file
164
test/is_iterator.cpp
Normal file
@ -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 <boost/iterator/is_iterator.hpp>
|
||||
#include <cstddef>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iterator>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
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();
|
||||
}
|
@ -8,7 +8,6 @@
|
||||
#include <boost/iterator/new_iterator_tests.hpp>
|
||||
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/polymorphic_cast.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
|
||||
@ -147,7 +146,7 @@ struct iterator_with_proxy_reference
|
||||
|
||||
template <class T, class U>
|
||||
void same_type(U const&)
|
||||
{ BOOST_MPL_ASSERT((boost::is_same<T,U>)); }
|
||||
{ BOOST_STATIC_ASSERT((boost::is_same<T,U>::value)); }
|
||||
|
||||
template <class I, class A>
|
||||
struct abstract_iterator
|
||||
@ -188,12 +187,12 @@ struct derived : base
|
||||
|
||||
virtual void assign(const base &b)
|
||||
{
|
||||
state = boost::polymorphic_cast<const derived *>(&b)->state;
|
||||
state = dynamic_cast<const derived &>(b).state;
|
||||
}
|
||||
|
||||
virtual bool equal(const base &b) const
|
||||
{
|
||||
return state == boost::polymorphic_cast<const derived *>(&b)->state;
|
||||
return state == dynamic_cast<const derived &>(b).state;
|
||||
}
|
||||
|
||||
int state;
|
||||
|
@ -5,15 +5,15 @@
|
||||
#ifndef STATIC_ASSERT_SAME_DWA2003530_HPP
|
||||
# define STATIC_ASSERT_SAME_DWA2003530_HPP
|
||||
|
||||
#include <boost/mpl/assert.hpp>
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#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 <class T1, class T2>
|
||||
struct static_assert_same
|
||||
{
|
||||
BOOST_MPL_ASSERT((::boost::is_same< T1, T2 >));
|
||||
STATIC_ASSERT_SAME(T1, T2);
|
||||
enum { value = 1 };
|
||||
};
|
||||
|
||||
|
20
test/test_cmake/CMakeLists.txt
Normal file
20
test/test_cmake/CMakeLists.txt
Normal file
@ -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)
|
54
test/test_cmake/main.cpp
Normal file
54
test/test_cmake/main.cpp
Normal file
@ -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 <boost/generator_iterator.hpp>
|
||||
#include <boost/indirect_reference.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <boost/pointee.hpp>
|
||||
#include <boost/shared_container_iterator.hpp>
|
||||
#include <boost/iterator/advance.hpp>
|
||||
#include <boost/iterator/counting_iterator.hpp>
|
||||
#include <boost/iterator/distance.hpp>
|
||||
#include <boost/iterator/filter_iterator.hpp>
|
||||
#include <boost/iterator/function_input_iterator.hpp>
|
||||
#include <boost/iterator/function_output_iterator.hpp>
|
||||
#include <boost/iterator/indirect_iterator.hpp>
|
||||
#include <boost/iterator/interoperable.hpp>
|
||||
#include <boost/iterator/is_iterator.hpp>
|
||||
#include <boost/iterator/is_lvalue_iterator.hpp>
|
||||
#include <boost/iterator/is_readable_iterator.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/iterator/iterator_archetypes.hpp>
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/iterator/iterator_concepts.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
#include <boost/iterator/minimum_category.hpp>
|
||||
#include <boost/iterator/new_iterator_tests.hpp>
|
||||
#include <boost/iterator/permutation_iterator.hpp>
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
#include <boost/iterator/zip_iterator.hpp>
|
||||
|
||||
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));
|
||||
}
|
Reference in New Issue
Block a user