mirror of
https://github.com/boostorg/range.git
synced 2025-06-25 12:01:40 +02:00
Compare commits
161 Commits
boost-1.58
...
develop
Author | SHA1 | Date | |
---|---|---|---|
f0e109312c | |||
3920ef2e7a | |||
41bff33b2c | |||
b2e4d5ad4b | |||
d52236c0b8 | |||
014c48f1b1 | |||
9c783ecbef | |||
d6e0a32f2e | |||
95095cf4bb | |||
88c6199aed | |||
fd40a25fea | |||
da69f60d3e | |||
6fc6e92adc | |||
e13030df17 | |||
6776ffa8e8 | |||
000b4882aa | |||
486c74fbeb | |||
f3ff60c3bc | |||
72e2a4457a | |||
bb27d50b31 | |||
5572b24a71 | |||
b42165a916 | |||
9a2960f01b | |||
4ed7887128 | |||
ee1ec1cf57 | |||
3b04f1a65e | |||
45d3aae111 | |||
0e8ad01bf9 | |||
c25b0e5069 | |||
994ff83292 | |||
77e5b868a0 | |||
474efda11a | |||
f1215fbda2 | |||
5f04231144 | |||
4e0b172a23 | |||
21a06a93aa | |||
6b3750f209 | |||
1bf2db29c0 | |||
9f03cc44d8 | |||
911d8a427d | |||
3496282d3b | |||
ce24356018 | |||
dbb6ef424f | |||
77a4dd5124 | |||
4ec46acdf5 | |||
cecebeea51 | |||
802fda6701 | |||
4ad147a220 | |||
221ae46c2b | |||
eced0cfac8 | |||
9f94c8703b | |||
023f45be01 | |||
364f755d99 | |||
af9f65e06e | |||
b91cb90dca | |||
7efe3c68f6 | |||
357bf3b980 | |||
9192996a93 | |||
4cfd4d8287 | |||
70d1727ed3 | |||
406226eccd | |||
05532829bd | |||
c24661a636 | |||
11dd528eb0 | |||
314b5d6b3c | |||
4dd5ad0f64 | |||
f1906e914e | |||
795046f8fc | |||
2aaa802e6a | |||
5b2500872d | |||
b1d5d23514 | |||
aaebfa5b20 | |||
95a62a3b3a | |||
67929cd7df | |||
5408f220dd | |||
937a411c3f | |||
1dac6a796e | |||
1234c59a39 | |||
e0d2e492a1 | |||
619c074146 | |||
4614777aaf | |||
83a352fa58 | |||
0e0d77cfab | |||
d1f36fba8d | |||
4283443532 | |||
3771624560 | |||
4a729678fd | |||
dfa3697764 | |||
efdd98332b | |||
8b98b696ff | |||
97951d2a8b | |||
efa2dc71f9 | |||
d99628981d | |||
e65434eb4f | |||
93513a3801 | |||
93eb91e63e | |||
f3a4246bd9 | |||
796080bbb8 | |||
370f1a4cd2 | |||
7d564572e2 | |||
9afc3bcbe2 | |||
69409ed63a | |||
23e5801e2a | |||
e476e1900a | |||
452b1bb7e7 | |||
7b89c747d6 | |||
deb3ae9800 | |||
56d470635d | |||
5c70a54597 | |||
f829c55c72 | |||
910fc7bf82 | |||
67c18ac1f1 | |||
5787c56994 | |||
9e5680b590 | |||
1b4f8100ef | |||
7567dce0c1 | |||
e48b9c38e7 | |||
283b8beddc | |||
4ce15f9b52 | |||
bb43887430 | |||
5a37aa4e98 | |||
0e931f4a80 | |||
5196baa1b0 | |||
1947daf1b5 | |||
7ca999c662 | |||
e7ebe14707 | |||
3225aaf82b | |||
262c0f96b3 | |||
1a3aeeb336 | |||
78a8f5bf3d | |||
9bf860fd30 | |||
64c83341ab | |||
6241dc62aa | |||
f83381d938 | |||
926318105e | |||
140866b402 | |||
490ba3fdcd | |||
e4f456d438 | |||
adcb071dc6 | |||
4f66482414 | |||
7fad9837fb | |||
11dbb1cb5a | |||
e961e66909 | |||
8847fd63cb | |||
62941f740d | |||
0c930a3697 | |||
09084d6355 | |||
9ca1622dd0 | |||
7669f52547 | |||
c6c4a8f3c1 | |||
3d5f3611ba | |||
8c1180f7f2 | |||
8ea11f9281 | |||
811b27141a | |||
a53bd134b2 | |||
0b28fd043f | |||
474c62ab16 | |||
de206a64db | |||
435ca994bf | |||
4a80ccd50d | |||
6f11252633 |
151
.travis.yml
Normal file
151
.travis.yml
Normal file
@ -0,0 +1,151 @@
|
||||
# Copyright 2016, 2017 Peter Dimov
|
||||
# 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:
|
||||
- os: linux
|
||||
compiler: g++
|
||||
env: TOOLSET=gcc CXXSTD=03,11
|
||||
|
||||
- os: linux
|
||||
compiler: g++-4.4
|
||||
env: TOOLSET=gcc-4.4 CXXSTD=98,0x
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.4
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-4.6
|
||||
env: TOOLSET=gcc-4.6 CXXSTD=03,0x
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-5
|
||||
env: TOOLSET=gcc-5 CXXSTD=03,11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-5
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-5
|
||||
env: TOOLSET=gcc-5 CXXSTD=14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-5
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-6
|
||||
env: TOOLSET=gcc-6 CXXSTD=03,11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-6
|
||||
env: TOOLSET=gcc-6 CXXSTD=14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-7
|
||||
env: TOOLSET=gcc-7 CXXSTD=03,11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-7
|
||||
env: TOOLSET=gcc-7 CXXSTD=14,17
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang CXXSTD=03,11
|
||||
|
||||
- os: linux
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang CXXSTD=14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libstdc++-4.9-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: osx
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang CXXSTD=03,11
|
||||
|
||||
- os: osx
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang CXXSTD=14,1z
|
||||
|
||||
install:
|
||||
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
||||
- cd ..
|
||||
- git clone -b $BOOST_BRANCH 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
|
||||
- cp -r $TRAVIS_BUILD_DIR/* libs/range
|
||||
- python tools/boostdep/depinst/depinst.py range
|
||||
- ./bootstrap.sh
|
||||
- ./b2 headers
|
||||
|
||||
script:
|
||||
- ./b2 -j 3 libs/range/test toolset=$TOOLSET cxxstd=$CXXSTD
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: always
|
41
CMakeLists.txt
Normal file
41
CMakeLists.txt
Normal file
@ -0,0 +1,41 @@
|
||||
# Generated by `boostdep --cmake range`
|
||||
# Copyright 2020 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
cmake_minimum_required(VERSION 3.5...3.16)
|
||||
|
||||
project(boost_range VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
|
||||
|
||||
add_library(boost_range INTERFACE)
|
||||
add_library(Boost::range ALIAS boost_range)
|
||||
|
||||
target_include_directories(boost_range INTERFACE include)
|
||||
|
||||
target_link_libraries(boost_range
|
||||
INTERFACE
|
||||
Boost::array
|
||||
Boost::assert
|
||||
Boost::concept_check
|
||||
Boost::config
|
||||
Boost::container_hash
|
||||
Boost::conversion
|
||||
Boost::core
|
||||
Boost::detail
|
||||
Boost::iterator
|
||||
Boost::mpl
|
||||
Boost::optional
|
||||
Boost::preprocessor
|
||||
Boost::regex
|
||||
Boost::static_assert
|
||||
Boost::tuple
|
||||
Boost::type_traits
|
||||
Boost::utility
|
||||
)
|
||||
|
||||
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
|
||||
|
||||
add_subdirectory(test)
|
||||
|
||||
endif()
|
||||
|
@ -28,3 +28,8 @@ boostbook quickbook
|
||||
<format>pdf:<xsl:param>img.src.path=$(images_location)/
|
||||
;
|
||||
|
||||
###############################################################################
|
||||
alias boostdoc ;
|
||||
explicit boostdoc ;
|
||||
alias boostrelease : quickbook ;
|
||||
explicit boostrelease ;
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
[section Overview]
|
||||
|
||||
A Range is a [*/concept/] similar to the STL [@http://www.sgi.com/Technology/STL/Container.html Container] concept. A Range provides iterators for accessing a half-open range `[first,one_past_last)` of elements and provides information about the number of elements in the Range. However, a Range has fewer requirements than a Container.
|
||||
A Range is a [*/concept/] similar to the STL [@http://www.sgi.com/tech/stl/Container.html Container] concept. A Range provides iterators for accessing a half-open range `[first,one_past_last)` of elements and provides information about the number of elements in the Range. However, a Range has fewer requirements than a Container.
|
||||
|
||||
The motivation for the Range concept is that there are many useful Container-like types that do not meet the full requirements of Container, and many algorithms that can be written with this reduced set of requirements. In particular, a Range does not necessarily
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
[[`<boost/range/adaptor/copied.hpp>`] [__range_adaptors_copied__]]
|
||||
[[`<boost/range/adaptor/filtered.hpp>`] [__range_adaptors_filtered__]]
|
||||
[[`<boost/range/adaptor/indexed.hpp>`] [__range_adaptors_indexed__]]
|
||||
[[`<boost/range/adaptor/indirected.hpp.`] [__range_adaptors_indirected__]]
|
||||
[[`<boost/range/adaptor/indirected.hpp>`] [__range_adaptors_indirected__]]
|
||||
[[`<boost/range/adaptor/map.hpp>`] [__range_adaptors_map_keys__ __range_adaptors_map_values__]]
|
||||
[[`<boost/range/adaptor/replaced.hpp>`] [__range_adaptors_replaced__]]
|
||||
[[`<boost/range/adaptor/replaced_if.hpp>`] [__range_adaptors_replaced_if__]]
|
||||
|
@ -172,6 +172,7 @@ rng | boost::adaptors::adaptor_generator
|
||||
[include adaptors/indirected.qbk]
|
||||
[include adaptors/map_keys.qbk]
|
||||
[include adaptors/map_values.qbk]
|
||||
[include adaptors/ref_unwrapped.qbk]
|
||||
[include adaptors/replaced.qbk]
|
||||
[include adaptors/replaced_if.qbk]
|
||||
[include adaptors/reversed.qbk]
|
||||
|
@ -12,9 +12,9 @@
|
||||
]
|
||||
|
||||
* [*Precondition:] The `value_type` of the range is convertible to the argument type of `pred`.
|
||||
* [*Postcondition:] For all adjacent elements `[x]` in the returned range, `pred(x)` is `true`.
|
||||
* [*Postcondition:] For all elements `[x]` in the returned range, `pred(x)` is `true`.
|
||||
* [*Throws:] Whatever the copy constructor of `pred` might throw.
|
||||
* [*Range Category:] __forward_range__
|
||||
* [*Range Category:] __singlepass_range__
|
||||
* [*Range Return Type:] `boost::filtered_range<decltype(rng)>`
|
||||
* [*Returned Range Category:] The minimum of the range category of `rng` and __bidirectional_range__
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
* [*Precondition:] The `value_type` of the range is an instantiation of `std::pair`.
|
||||
* [*Postcondition:] For all elements `x` in the returned range, `x` is the result of `y.second` where `y` is the corresponding element in the original range.
|
||||
* [*Range Category:] __single_pass_range__
|
||||
* [*Range Return Type:] for constant ranges, `boost::select_second_const<decltype(rng)>` otherwise `boost:select_second_mutable<decltype(rng)>`
|
||||
* [*Range Return Type:] for constant ranges, `boost::select_second_const<decltype(rng)>` otherwise `boost::select_second_mutable<decltype(rng)>`
|
||||
* [*Returned Range Category:] The range category of `rng`.
|
||||
|
||||
[section:map_values_example map_values example]
|
||||
|
32
doc/reference/adaptors/ref_unwrapped.qbk
Normal file
32
doc/reference/adaptors/ref_unwrapped.qbk
Normal file
@ -0,0 +1,32 @@
|
||||
[/
|
||||
Copyright 2015 Robin Eckert
|
||||
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)
|
||||
/]
|
||||
[section:ref_unwrapped ref_unwrapped]
|
||||
|
||||
[table
|
||||
[[Syntax] [Code]]
|
||||
[[Pipe] [`rng | boost::adaptors::ref_unwrapped`]]
|
||||
[[Function] [`boost::adaptors::ref_unwrap(rng)`]]
|
||||
]
|
||||
|
||||
This adaptor produces a range than applies `.get()` on all values in
|
||||
the range. It is useful for iterating ranges of
|
||||
`std::reference_wrapper` values or values using similar semantics.
|
||||
|
||||
The adaptor is C++11 (and above) only.
|
||||
|
||||
* [*Precondition:] The `value_type` of the range has a `.get() const`.
|
||||
* [*Postcondition:] For all elements `x` in the returned range, `x` is the result of `y.get()` where `y` is the corresponding element in the original range.
|
||||
* [*Range Category:] __single_pass_range__
|
||||
* [*Range Return Type:] `boost::unwrap_ref_range<decltype(rng)>`
|
||||
* [*Returned Range Category:] The range category of `rng`.
|
||||
|
||||
[section:ref_unwrapped_example ref_unwrapped example]
|
||||
[import ../../../test/adaptor_test/ref_unwrapped_example.cpp]
|
||||
[ref_unwrapped_example]
|
||||
[endsect]
|
||||
|
||||
This would produce the output `123`.
|
||||
[endsect]
|
@ -7,8 +7,8 @@
|
||||
|
||||
[table
|
||||
[[Syntax] [Code]]
|
||||
[[Pipe] [`rng | boost::adaptors::replaced(new_value, old_value)`]]
|
||||
[[Function] [`boost::adaptors::replace(rng, new_value, old_value)`]]
|
||||
[[Pipe] [`rng | boost::adaptors::replaced(old_value, new_value)`]]
|
||||
[[Function] [`boost::adaptors::replace(rng, old_value, new_value)`]]
|
||||
]
|
||||
|
||||
* [*Precondition:]
|
||||
|
@ -13,14 +13,14 @@ template<
|
||||
class UnaryPredicate
|
||||
>
|
||||
typename range_iterator<ForwardRange>::type
|
||||
remove(ForwardRange& rng, UnaryPredicate pred);
|
||||
remove_if(ForwardRange& rng, UnaryPredicate pred);
|
||||
|
||||
template<
|
||||
class ForwardRange,
|
||||
class UnaryPredicate
|
||||
>
|
||||
typename range_iterator<const ForwardRange>::type
|
||||
remove(const ForwardRange& rng, UnaryPredicate pred);
|
||||
remove_if(const ForwardRange& rng, UnaryPredicate pred);
|
||||
|
||||
template<
|
||||
range_return_value re,
|
||||
@ -28,7 +28,7 @@ template<
|
||||
class UnaryPredicate
|
||||
>
|
||||
typename range_return<ForwardRange,re>::type
|
||||
remove(ForwardRange& rng, UnaryPredicate pred);
|
||||
remove_if(ForwardRange& rng, UnaryPredicate pred);
|
||||
|
||||
template<
|
||||
range_return_value re,
|
||||
@ -36,7 +36,7 @@ template<
|
||||
class UnaryPredicate
|
||||
>
|
||||
typename range_return<const ForwardRange,re>::type
|
||||
remove(const ForwardRange& rng, UnaryPredicate pred);
|
||||
remove_if(const ForwardRange& rng, UnaryPredicate pred);
|
||||
``
|
||||
|
||||
[heading Description]
|
||||
|
@ -19,9 +19,11 @@ bool is_sorted(const SinglePassRange& rng, BinaryPredicate pred);
|
||||
|
||||
`is_sorted` determines if a range is sorted.
|
||||
For the non-predicate version the return value is `true` if and only if for
|
||||
each adjacent elements `[x,y]` the expression `x < y` is `true`.
|
||||
each adjacent elements `[x, y]` the expression `y < x` is `false` (i.e.,
|
||||
`x <= y`), or if the number of elements is zero or one.
|
||||
For the predicate version the return value is `true` is and only if for each
|
||||
adjacent elements `[x,y]` the expression `pred(x,y)` is `true`.
|
||||
adjacent elements `[x, y]` the expression `pred(y, x)` is `false`, or if the
|
||||
number of elements is zero or one.
|
||||
|
||||
[heading Definition]
|
||||
|
||||
|
@ -10,7 +10,11 @@
|
||||
``
|
||||
template<class Integer>
|
||||
iterator_range< range_detail::integer_iterator<Integer> >
|
||||
irange(Integer first, Integer last);
|
||||
irange(Integer last);
|
||||
|
||||
template<class Integer>
|
||||
iterator_range< range_detail::integer_iterator<Integer> >
|
||||
irange(Integer first, Integer last);
|
||||
|
||||
template<class Integer, class StepSize>
|
||||
iterator_range< range_detail::integer_iterator_with_step<Integer, StepSize> >
|
||||
@ -37,4 +41,3 @@ Defined in the header file `boost/range/irange.hpp`
|
||||
Constant. Since this function generates a new range the most significant performance cost is incurred through the iteration of the generated range.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -354,7 +354,7 @@ int main(int, const char*[])
|
||||
char tc;
|
||||
BOOST_FOREACH(boost::tie(ti, tc), boost::combine(v, l))
|
||||
{
|
||||
std::cout << '(' << ti << ',' << tv << ')' << '\n';
|
||||
std::cout << '(' << ti << ',' << tc << ')' << '\n';
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -181,7 +181,7 @@ namespace boost
|
||||
}
|
||||
|
||||
template< class ForwardRng, class BinPredicate >
|
||||
inline adjacent_filtered_range<BinPredicate, ForwardRng, false>
|
||||
inline adjacent_filtered_range<BinPredicate, const ForwardRng, false>
|
||||
operator|( const ForwardRng& r,
|
||||
const adjacent_excl_holder<BinPredicate>& f )
|
||||
{
|
||||
|
@ -56,23 +56,23 @@ namespace boost
|
||||
{ }
|
||||
};
|
||||
|
||||
template< class ForwardRange, class Predicate >
|
||||
inline filtered_range<Predicate, ForwardRange>
|
||||
operator|(ForwardRange& r,
|
||||
template< class SinglePassRange, class Predicate >
|
||||
inline filtered_range<Predicate, SinglePassRange>
|
||||
operator|(SinglePassRange& r,
|
||||
const filter_holder<Predicate>& f)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
|
||||
return filtered_range<Predicate, ForwardRange>( f.val, r );
|
||||
BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<SinglePassRange>));
|
||||
return filtered_range<Predicate, SinglePassRange>( f.val, r );
|
||||
}
|
||||
|
||||
template< class ForwardRange, class Predicate >
|
||||
inline filtered_range<Predicate, const ForwardRange>
|
||||
operator|(const ForwardRange& r,
|
||||
template< class SinglePassRange, class Predicate >
|
||||
inline filtered_range<Predicate, const SinglePassRange>
|
||||
operator|(const SinglePassRange& r,
|
||||
const filter_holder<Predicate>& f )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
ForwardRangeConcept<const ForwardRange>));
|
||||
return filtered_range<Predicate, const ForwardRange>( f.val, r );
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
return filtered_range<Predicate, const SinglePassRange>( f.val, r );
|
||||
}
|
||||
|
||||
} // 'range_detail'
|
||||
@ -93,23 +93,26 @@ namespace boost
|
||||
range_detail::forwarder<range_detail::filter_holder>();
|
||||
}
|
||||
|
||||
template<class ForwardRange, class Predicate>
|
||||
inline filtered_range<Predicate, ForwardRange>
|
||||
filter(ForwardRange& rng, Predicate filter_pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
|
||||
|
||||
return range_detail::filtered_range<Predicate, ForwardRange>( filter_pred, rng );
|
||||
}
|
||||
|
||||
template<class ForwardRange, class Predicate>
|
||||
inline filtered_range<Predicate, const ForwardRange>
|
||||
filter(const ForwardRange& rng, Predicate filter_pred)
|
||||
template<class SinglePassRange, class Predicate>
|
||||
inline filtered_range<Predicate, SinglePassRange>
|
||||
filter(SinglePassRange& rng, Predicate filter_pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
ForwardRangeConcept<const ForwardRange>));
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
|
||||
return range_detail::filtered_range<Predicate, const ForwardRange>( filter_pred, rng );
|
||||
return range_detail::filtered_range<
|
||||
Predicate, SinglePassRange>( filter_pred, rng );
|
||||
}
|
||||
|
||||
template<class SinglePassRange, class Predicate>
|
||||
inline filtered_range<Predicate, const SinglePassRange>
|
||||
filter(const SinglePassRange& rng, Predicate filter_pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return range_detail::filtered_range<
|
||||
Predicate, const SinglePassRange>( filter_pred, rng );
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
|
@ -367,4 +367,29 @@ index(
|
||||
} // namespace adaptors
|
||||
} // namespace boost
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
|
||||
|
||||
namespace std {
|
||||
|
||||
#if defined(BOOST_CLANG)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wmismatched-tags"
|
||||
#endif
|
||||
|
||||
template<size_t N, class T, class Indexable>
|
||||
struct tuple_element<N, boost::range::index_value<T, Indexable>>:
|
||||
boost::tuples::element<N, boost::range::index_value<T, Indexable>> {};
|
||||
|
||||
template<class T, class Indexable>
|
||||
struct tuple_size<boost::range::index_value<T, Indexable>>:
|
||||
std::integral_constant<std::size_t, 2> {};
|
||||
|
||||
#if defined(BOOST_CLANG)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // !defined(BOOST_NO_CXX11_HDR_TUPLE)
|
||||
|
||||
#endif // include guard
|
||||
|
102
include/boost/range/adaptor/ref_unwrapped.hpp
Normal file
102
include/boost/range/adaptor/ref_unwrapped.hpp
Normal file
@ -0,0 +1,102 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Robin Eckert 2015.
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. 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)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
|
||||
#ifndef BOOST_RANGE_ADAPTOR_REF_UNWRAPPED_HPP
|
||||
#define BOOST_RANGE_ADAPTOR_REF_UNWRAPPED_HPP
|
||||
|
||||
#include <boost/range/adaptor/transformed.hpp>
|
||||
#include <boost/range/reference.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/type_traits/declval.hpp>
|
||||
#include <utility>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_DECLTYPE)
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
struct ref_unwrapped_forwarder {};
|
||||
|
||||
template<class SinglePassRange>
|
||||
struct unwrap_ref
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
range_reference<SinglePassRange>::type argument_type;
|
||||
|
||||
typedef decltype( boost::declval<argument_type>().get() ) result_type;
|
||||
|
||||
result_type operator()( argument_type &&r ) const
|
||||
{
|
||||
return r.get();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<class SinglePassRange>
|
||||
class unwrap_ref_range
|
||||
: public transformed_range<unwrap_ref<SinglePassRange>,
|
||||
SinglePassRange>
|
||||
{
|
||||
typedef transformed_range<unwrap_ref<SinglePassRange>,
|
||||
SinglePassRange> base;
|
||||
public:
|
||||
typedef unwrap_ref<SinglePassRange> transform_fn_type;
|
||||
typedef SinglePassRange source_range_type;
|
||||
|
||||
unwrap_ref_range(transform_fn_type fn, source_range_type &rng)
|
||||
: base(fn, rng)
|
||||
{
|
||||
}
|
||||
|
||||
unwrap_ref_range(const base &other) : base(other) {}
|
||||
};
|
||||
|
||||
template<class SinglePassRange>
|
||||
inline unwrap_ref_range<SinglePassRange>
|
||||
operator|(SinglePassRange& r, ref_unwrapped_forwarder)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
|
||||
return operator|( r,
|
||||
boost::adaptors::transformed(unwrap_ref<SinglePassRange>()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
using range_detail::unwrap_ref_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const range_detail::ref_unwrapped_forwarder ref_unwrapped =
|
||||
range_detail::ref_unwrapped_forwarder();
|
||||
}
|
||||
|
||||
template<class SinglePassRange>
|
||||
inline unwrap_ref_range<SinglePassRange>
|
||||
ref_unwrap(SinglePassRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
|
||||
return unwrap_ref_range<SinglePassRange>(
|
||||
range_detail::unwrap_ref<SinglePassRange>(), rng );
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -101,12 +101,9 @@ namespace boost
|
||||
void operator=(const replace_holder&);
|
||||
};
|
||||
|
||||
template< class SinglePassRange >
|
||||
template< class SinglePassRange, class Value >
|
||||
inline replaced_range<SinglePassRange>
|
||||
operator|(
|
||||
SinglePassRange& r,
|
||||
const replace_holder<
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type>& f )
|
||||
operator|(SinglePassRange& r, const replace_holder<Value>& f)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
@ -114,12 +111,9 @@ namespace boost
|
||||
return replaced_range<SinglePassRange>(r, f.val1, f.val2);
|
||||
}
|
||||
|
||||
template< class SinglePassRange >
|
||||
template< class SinglePassRange, class Value >
|
||||
inline replaced_range<const SinglePassRange>
|
||||
operator|(
|
||||
const SinglePassRange& r,
|
||||
const replace_holder<
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type>& f)
|
||||
operator|(const SinglePassRange& r, const replace_holder<Value>& f)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
@ -139,11 +133,9 @@ namespace boost
|
||||
range_detail::forwarder2<range_detail::replace_holder>();
|
||||
}
|
||||
|
||||
template<class SinglePassRange>
|
||||
template< class SinglePassRange, class Value >
|
||||
inline replaced_range<SinglePassRange>
|
||||
replace(SinglePassRange& rng,
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type from,
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type to)
|
||||
replace(SinglePassRange& rng, Value from, Value to)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
@ -151,11 +143,9 @@ namespace boost
|
||||
return replaced_range<SinglePassRange>(rng, from, to);
|
||||
}
|
||||
|
||||
template<class SinglePassRange>
|
||||
template< class SinglePassRange, class Value >
|
||||
inline replaced_range<const SinglePassRange>
|
||||
replace(const SinglePassRange& rng,
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type from,
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type to)
|
||||
replace(const SinglePassRange& rng, Value from, Value to)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
@ -103,13 +103,9 @@ namespace boost
|
||||
T m_to;
|
||||
};
|
||||
|
||||
template< class Pred, class SinglePassRange >
|
||||
template< class Pred, class SinglePassRange, class Value >
|
||||
inline replaced_if_range<Pred, SinglePassRange>
|
||||
operator|(
|
||||
SinglePassRange& r,
|
||||
const replace_if_holder<
|
||||
Pred,
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type>& f)
|
||||
operator|(SinglePassRange& r, const replace_if_holder<Pred, Value>& f)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
@ -118,13 +114,9 @@ namespace boost
|
||||
r, f.pred(), f.to());
|
||||
}
|
||||
|
||||
template< class Pred, class SinglePassRange >
|
||||
template< class Pred, class SinglePassRange, class Value >
|
||||
inline replaced_if_range<Pred, const SinglePassRange>
|
||||
operator|(
|
||||
const SinglePassRange& r,
|
||||
const replace_if_holder<
|
||||
Pred,
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type>& f)
|
||||
operator|(const SinglePassRange& r, const replace_if_holder<Pred, Value>& f)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
@ -145,10 +137,9 @@ namespace boost
|
||||
range_detail::forwarder2TU<range_detail::replace_if_holder>();
|
||||
}
|
||||
|
||||
template<class Pred, class SinglePassRange>
|
||||
template< class Pred, class SinglePassRange, class Value >
|
||||
inline replaced_if_range<Pred, SinglePassRange>
|
||||
replace_if(SinglePassRange& rng, Pred pred,
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type to)
|
||||
replace_if(SinglePassRange& rng, Pred pred, Value to)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
@ -157,12 +148,9 @@ namespace boost
|
||||
rng, pred, to);
|
||||
}
|
||||
|
||||
template<class Pred, class SinglePassRange>
|
||||
template< class Pred, class SinglePassRange, class Value >
|
||||
inline replaced_if_range<Pred, const SinglePassRange>
|
||||
replace_if(
|
||||
const SinglePassRange& rng,
|
||||
Pred pred,
|
||||
BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type to)
|
||||
replace_if(const SinglePassRange& rng, Pred pred, Value to)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <boost/range/size_type.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
@ -603,7 +603,7 @@ namespace boost
|
||||
template<
|
||||
class Rng,
|
||||
class Category =
|
||||
typename iterator_traversal<
|
||||
typename iterators::pure_iterator_traversal<
|
||||
typename range_iterator<Rng>::type
|
||||
>::type
|
||||
>
|
||||
|
@ -31,7 +31,7 @@ inline BOOST_DEDUCED_TYPENAME disable_if<
|
||||
is_const<ForwardRange>,
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
|
||||
>::type
|
||||
lower_bound( ForwardRange& rng, Value val )
|
||||
lower_bound( ForwardRange& rng, const Value& val )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return std::lower_bound(boost::begin(rng), boost::end(rng), val);
|
||||
@ -40,7 +40,7 @@ lower_bound( ForwardRange& rng, Value val )
|
||||
/// \overload
|
||||
template< class ForwardRange, class Value >
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
|
||||
lower_bound( const ForwardRange& rng, Value val )
|
||||
lower_bound( const ForwardRange& rng, const Value& val )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return std::lower_bound(boost::begin(rng), boost::end(rng), val);
|
||||
@ -52,7 +52,7 @@ inline BOOST_DEDUCED_TYPENAME disable_if<
|
||||
is_const<ForwardRange>,
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
|
||||
>::type
|
||||
lower_bound( ForwardRange& rng, Value val, SortPredicate pred )
|
||||
lower_bound( ForwardRange& rng, const Value& val, SortPredicate pred )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return std::lower_bound(boost::begin(rng), boost::end(rng), val, pred);
|
||||
@ -61,7 +61,7 @@ lower_bound( ForwardRange& rng, Value val, SortPredicate pred )
|
||||
/// \overload
|
||||
template< class ForwardRange, class Value, class SortPredicate >
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
|
||||
lower_bound( const ForwardRange& rng, Value val, SortPredicate pred )
|
||||
lower_bound( const ForwardRange& rng, const Value& val, SortPredicate pred )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return std::lower_bound(boost::begin(rng), boost::end(rng), val, pred);
|
||||
@ -73,7 +73,7 @@ inline BOOST_DEDUCED_TYPENAME disable_if<
|
||||
is_const<ForwardRange>,
|
||||
BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
|
||||
>::type
|
||||
lower_bound( ForwardRange& rng, Value val )
|
||||
lower_bound( ForwardRange& rng, const Value& val )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return range_return<ForwardRange,re>::
|
||||
@ -84,7 +84,7 @@ lower_bound( ForwardRange& rng, Value val )
|
||||
/// \overload
|
||||
template< range_return_value re, class ForwardRange, class Value >
|
||||
inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
|
||||
lower_bound( const ForwardRange& rng, Value val )
|
||||
lower_bound( const ForwardRange& rng, const Value& val )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return range_return<const ForwardRange,re>::
|
||||
@ -98,7 +98,7 @@ inline BOOST_DEDUCED_TYPENAME disable_if<
|
||||
is_const<ForwardRange>,
|
||||
BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
|
||||
>::type
|
||||
lower_bound( ForwardRange& rng, Value val, SortPredicate pred )
|
||||
lower_bound( ForwardRange& rng, const Value& val, SortPredicate pred )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return range_return<ForwardRange,re>::
|
||||
@ -109,7 +109,7 @@ lower_bound( ForwardRange& rng, Value val, SortPredicate pred )
|
||||
/// \overload
|
||||
template< range_return_value re, class ForwardRange, class Value, class SortPredicate >
|
||||
inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
|
||||
lower_bound( const ForwardRange& rng, Value val, SortPredicate pred )
|
||||
lower_bound( const ForwardRange& rng, const Value& val, SortPredicate pred )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return range_return<const ForwardRange,re>::
|
||||
|
@ -3,6 +3,7 @@
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Copyright 2019 Glen Joseph Fernandes (glenjofe@gmail.com)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
@ -13,14 +14,35 @@
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/range/detail/less.hpp>
|
||||
#include <boost/range/detail/range_return.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<typename Iterator, class Predicate>
|
||||
inline Iterator
|
||||
max_element(Iterator first, Iterator last, Predicate comp)
|
||||
{
|
||||
if (first == last) {
|
||||
return last;
|
||||
}
|
||||
Iterator result = first;
|
||||
while (++first != last) {
|
||||
if (comp(*result, *first)) {
|
||||
result = first;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// \brief template function max_element
|
||||
///
|
||||
/// range-based version of the max_element std algorithm
|
||||
@ -32,7 +54,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
|
||||
max_element(ForwardRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return std::max_element(boost::begin(rng), boost::end(rng));
|
||||
return detail::max_element(boost::begin(rng), boost::end(rng), detail::less());
|
||||
}
|
||||
|
||||
/// \overload
|
||||
@ -41,7 +63,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
|
||||
max_element(const ForwardRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return std::max_element(boost::begin(rng), boost::end(rng));
|
||||
return detail::max_element(boost::begin(rng), boost::end(rng), detail::less());
|
||||
}
|
||||
|
||||
/// \overload
|
||||
@ -50,7 +72,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
|
||||
max_element(ForwardRange& rng, BinaryPredicate pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return std::max_element(boost::begin(rng), boost::end(rng), pred);
|
||||
return detail::max_element(boost::begin(rng), boost::end(rng), pred);
|
||||
}
|
||||
|
||||
/// \overload
|
||||
@ -59,7 +81,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
|
||||
max_element(const ForwardRange& rng, BinaryPredicate pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return std::max_element(boost::begin(rng), boost::end(rng), pred);
|
||||
return detail::max_element(boost::begin(rng), boost::end(rng), pred);
|
||||
}
|
||||
|
||||
// range_return overloads
|
||||
@ -71,7 +93,7 @@ max_element(ForwardRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return range_return<ForwardRange,re>::pack(
|
||||
std::max_element(boost::begin(rng), boost::end(rng)),
|
||||
detail::max_element(boost::begin(rng), boost::end(rng), detail::less()),
|
||||
rng);
|
||||
}
|
||||
|
||||
@ -82,7 +104,7 @@ max_element(const ForwardRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return range_return<const ForwardRange,re>::pack(
|
||||
std::max_element(boost::begin(rng), boost::end(rng)),
|
||||
detail::max_element(boost::begin(rng), boost::end(rng), detail::less()),
|
||||
rng);
|
||||
}
|
||||
|
||||
@ -93,7 +115,7 @@ max_element(ForwardRange& rng, BinaryPredicate pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return range_return<ForwardRange,re>::pack(
|
||||
std::max_element(boost::begin(rng), boost::end(rng), pred),
|
||||
detail::max_element(boost::begin(rng), boost::end(rng), pred),
|
||||
rng);
|
||||
}
|
||||
|
||||
@ -104,7 +126,7 @@ max_element(const ForwardRange& rng, BinaryPredicate pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return range_return<const ForwardRange,re>::pack(
|
||||
std::max_element(boost::begin(rng), boost::end(rng), pred),
|
||||
detail::max_element(boost::begin(rng), boost::end(rng), pred),
|
||||
rng);
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Copyright 2019 Glen Joseph Fernandes (glenjofe@gmail.com)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
@ -13,14 +14,35 @@
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/range/detail/less.hpp>
|
||||
#include <boost/range/detail/range_return.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<typename Iterator, class Predicate>
|
||||
inline Iterator
|
||||
min_element(Iterator first, Iterator last, Predicate comp)
|
||||
{
|
||||
if (first == last) {
|
||||
return last;
|
||||
}
|
||||
Iterator result = first;
|
||||
while (++first != last) {
|
||||
if (comp(*first, *result)) {
|
||||
result = first;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// \brief template function min_element
|
||||
///
|
||||
/// range-based version of the min_element std algorithm
|
||||
@ -32,7 +54,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
|
||||
min_element(ForwardRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return std::min_element(boost::begin(rng), boost::end(rng));
|
||||
return detail::min_element(boost::begin(rng), boost::end(rng), detail::less());
|
||||
}
|
||||
|
||||
/// \overload
|
||||
@ -41,7 +63,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
|
||||
min_element(const ForwardRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return std::min_element(boost::begin(rng), boost::end(rng));
|
||||
return detail::min_element(boost::begin(rng), boost::end(rng), detail::less());
|
||||
}
|
||||
|
||||
/// \overload
|
||||
@ -50,7 +72,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
|
||||
min_element(ForwardRange& rng, BinaryPredicate pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return std::min_element(boost::begin(rng), boost::end(rng), pred);
|
||||
return detail::min_element(boost::begin(rng), boost::end(rng), pred);
|
||||
}
|
||||
|
||||
/// \overload
|
||||
@ -59,7 +81,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
|
||||
min_element(const ForwardRange& rng, BinaryPredicate pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return std::min_element(boost::begin(rng), boost::end(rng), pred);
|
||||
return detail::min_element(boost::begin(rng), boost::end(rng), pred);
|
||||
}
|
||||
|
||||
// range_return overloads
|
||||
@ -71,7 +93,7 @@ min_element(ForwardRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return range_return<ForwardRange,re>::pack(
|
||||
std::min_element(boost::begin(rng), boost::end(rng)),
|
||||
detail::min_element(boost::begin(rng), boost::end(rng), detail::less()),
|
||||
rng);
|
||||
}
|
||||
|
||||
@ -82,7 +104,7 @@ min_element(const ForwardRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return range_return<const ForwardRange,re>::pack(
|
||||
std::min_element(boost::begin(rng), boost::end(rng)),
|
||||
detail::min_element(boost::begin(rng), boost::end(rng), detail::less()),
|
||||
rng);
|
||||
}
|
||||
|
||||
@ -93,7 +115,7 @@ min_element(ForwardRange& rng, BinaryPredicate pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return range_return<ForwardRange,re>::pack(
|
||||
std::min_element(boost::begin(rng), boost::end(rng), pred),
|
||||
detail::min_element(boost::begin(rng), boost::end(rng), pred),
|
||||
rng);
|
||||
}
|
||||
|
||||
@ -104,7 +126,7 @@ min_element(const ForwardRange& rng, BinaryPredicate pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return range_return<const ForwardRange,re>::pack(
|
||||
std::min_element(boost::begin(rng), boost::end(rng), pred),
|
||||
detail::min_element(boost::begin(rng), boost::end(rng), pred),
|
||||
rng);
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,85 @@
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <algorithm>
|
||||
#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE
|
||||
|
||||
// wrap std::rand as UniformRandomBitGenerator
|
||||
struct wrap_rand
|
||||
{
|
||||
typedef unsigned int result_type;
|
||||
|
||||
static BOOST_CONSTEXPR result_type (min)()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOST_CONSTEXPR result_type (max)()
|
||||
{
|
||||
return RAND_MAX;
|
||||
}
|
||||
|
||||
result_type operator()()
|
||||
{
|
||||
return std::rand();
|
||||
}
|
||||
};
|
||||
|
||||
template< class RandomIt >
|
||||
inline void random_shuffle(RandomIt first, RandomIt last)
|
||||
{
|
||||
std::shuffle(first, last, wrap_rand());
|
||||
}
|
||||
|
||||
// wrap Generator as UniformRandomBitGenerator
|
||||
template< class Generator >
|
||||
struct wrap_generator
|
||||
{
|
||||
typedef unsigned int result_type;
|
||||
static const int max_arg = ((0u - 1u) >> 2) + 1;
|
||||
Generator& g;
|
||||
|
||||
wrap_generator(Generator& gen) : g(gen) {}
|
||||
|
||||
static BOOST_CONSTEXPR result_type (min)()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOST_CONSTEXPR result_type (max)()
|
||||
{
|
||||
return max_arg - 1;
|
||||
}
|
||||
|
||||
result_type operator()()
|
||||
{
|
||||
return static_cast<result_type>(g(max_arg));
|
||||
}
|
||||
};
|
||||
|
||||
template< class RandomIt, class Generator >
|
||||
inline void random_shuffle(RandomIt first, RandomIt last, Generator& gen)
|
||||
{
|
||||
std::shuffle(first, last, wrap_generator< Generator >(gen));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
using std::random_shuffle;
|
||||
|
||||
#endif
|
||||
} // namespace detail
|
||||
|
||||
/// \brief template function random_shuffle
|
||||
///
|
||||
/// range-based version of the random_shuffle std algorithm
|
||||
@ -30,7 +103,7 @@ template<class RandomAccessRange>
|
||||
inline RandomAccessRange& random_shuffle(RandomAccessRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<RandomAccessRange> ));
|
||||
std::random_shuffle(boost::begin(rng), boost::end(rng));
|
||||
detail::random_shuffle(boost::begin(rng), boost::end(rng));
|
||||
return rng;
|
||||
}
|
||||
|
||||
@ -39,7 +112,7 @@ template<class RandomAccessRange>
|
||||
inline const RandomAccessRange& random_shuffle(const RandomAccessRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
|
||||
std::random_shuffle(boost::begin(rng), boost::end(rng));
|
||||
detail::random_shuffle(boost::begin(rng), boost::end(rng));
|
||||
return rng;
|
||||
}
|
||||
|
||||
@ -48,7 +121,7 @@ template<class RandomAccessRange, class Generator>
|
||||
inline RandomAccessRange& random_shuffle(RandomAccessRange& rng, Generator& gen)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<RandomAccessRange> ));
|
||||
std::random_shuffle(boost::begin(rng), boost::end(rng), gen);
|
||||
detail::random_shuffle(boost::begin(rng), boost::end(rng), gen);
|
||||
return rng;
|
||||
}
|
||||
|
||||
@ -57,7 +130,7 @@ template<class RandomAccessRange, class Generator>
|
||||
inline const RandomAccessRange& random_shuffle(const RandomAccessRange& rng, Generator& gen)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
|
||||
std::random_shuffle(boost::begin(rng), boost::end(rng), gen);
|
||||
detail::random_shuffle(boost::begin(rng), boost::end(rng), gen);
|
||||
return rng;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ BOOST_DEDUCED_TYPENAME disable_if<
|
||||
is_const<ForwardRange>,
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
|
||||
>::type
|
||||
upper_bound( ForwardRange& rng, Value val )
|
||||
upper_bound( ForwardRange& rng, const Value& val )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return std::upper_bound(boost::begin(rng), boost::end(rng), val);
|
||||
@ -41,7 +41,7 @@ upper_bound( ForwardRange& rng, Value val )
|
||||
/// \overload
|
||||
template< class ForwardRange, class Value >
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
|
||||
upper_bound( const ForwardRange& rng, Value val )
|
||||
upper_bound( const ForwardRange& rng, const Value& val )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return std::upper_bound(boost::begin(rng), boost::end(rng), val);
|
||||
@ -53,7 +53,7 @@ inline BOOST_DEDUCED_TYPENAME disable_if<
|
||||
is_const<ForwardRange>,
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
|
||||
>::type
|
||||
upper_bound( ForwardRange& rng, Value val, SortPredicate pred )
|
||||
upper_bound( ForwardRange& rng, const Value& val, SortPredicate pred )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return std::upper_bound(boost::begin(rng), boost::end(rng), val, pred);
|
||||
@ -62,7 +62,7 @@ upper_bound( ForwardRange& rng, Value val, SortPredicate pred )
|
||||
/// \overload
|
||||
template< class ForwardRange, class Value, class SortPredicate >
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
|
||||
upper_bound( const ForwardRange& rng, Value val, SortPredicate pred )
|
||||
upper_bound( const ForwardRange& rng, const Value& val, SortPredicate pred )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return std::upper_bound(boost::begin(rng), boost::end(rng), val, pred);
|
||||
@ -74,7 +74,7 @@ inline BOOST_DEDUCED_TYPENAME disable_if<
|
||||
is_const<ForwardRange>,
|
||||
BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
|
||||
>::type
|
||||
upper_bound( ForwardRange& rng, Value val )
|
||||
upper_bound( ForwardRange& rng, const Value& val )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return range_return<ForwardRange,re>::
|
||||
@ -85,7 +85,7 @@ upper_bound( ForwardRange& rng, Value val )
|
||||
/// \overload
|
||||
template< range_return_value re, class ForwardRange, class Value >
|
||||
inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
|
||||
upper_bound( const ForwardRange& rng, Value val )
|
||||
upper_bound( const ForwardRange& rng, const Value& val )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return range_return<const ForwardRange,re>::
|
||||
@ -100,7 +100,7 @@ inline BOOST_DEDUCED_TYPENAME disable_if<
|
||||
is_const<ForwardRange>,
|
||||
BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
|
||||
>::type
|
||||
upper_bound( ForwardRange& rng, Value val, SortPredicate pred )
|
||||
upper_bound( ForwardRange& rng, const Value& val, SortPredicate pred )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
|
||||
return range_return<ForwardRange,re>::
|
||||
@ -112,7 +112,7 @@ upper_bound( ForwardRange& rng, Value val, SortPredicate pred )
|
||||
template< range_return_value re, class ForwardRange, class Value,
|
||||
class SortPredicate >
|
||||
inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
|
||||
upper_bound( const ForwardRange& rng, Value val, SortPredicate pred )
|
||||
upper_bound( const ForwardRange& rng, const Value& val, SortPredicate pred )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
return range_return<const ForwardRange,re>::
|
||||
|
@ -52,10 +52,31 @@ inline Container& remove_erase_if( Container& on, Pred pred )
|
||||
return on;
|
||||
}
|
||||
|
||||
template< class Container >
|
||||
inline Container& unique_erase( Container& on)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
|
||||
on.erase(
|
||||
std::unique(boost::begin(on), boost::end(on)),
|
||||
boost::end(on));
|
||||
return on;
|
||||
}
|
||||
|
||||
template< class Container, class Pred >
|
||||
inline Container& unique_erase( Container& on, Pred pred )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
|
||||
on.erase(
|
||||
std::unique(boost::begin(on), boost::end(on), pred),
|
||||
boost::end(on));
|
||||
return on;
|
||||
}
|
||||
|
||||
} // namespace range
|
||||
using range::erase;
|
||||
using range::remove_erase;
|
||||
using range::remove_erase_if;
|
||||
using range::unique_erase;
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
|
@ -39,6 +39,7 @@ inline Container& insert( Container& on, const Range& from )
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<Range> ));
|
||||
on.insert(boost::begin(from), boost::end(from));
|
||||
return on;
|
||||
}
|
||||
|
||||
} // namespace range
|
||||
|
@ -28,8 +28,6 @@ namespace boost
|
||||
return boost::make_iterator_range( r );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template< class Range >
|
||||
inline boost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<const Range>::type >
|
||||
as_array( const Range& r )
|
||||
@ -37,8 +35,6 @@ namespace boost
|
||||
return boost::make_iterator_range( r );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -15,16 +15,17 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
#include <boost/range/detail/as_literal.hpp>
|
||||
#else
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/detail/str_types.hpp>
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_CHAR16_T) || !defined(BOOST_NO_CXX11_CHAR32_T)
|
||||
#include <string> // for std::char_traits
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#include <cwchar>
|
||||
#endif
|
||||
@ -38,6 +39,20 @@ namespace boost
|
||||
return strlen( s );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CXX11_CHAR16_T
|
||||
inline std::size_t length( const char16_t* s )
|
||||
{
|
||||
return std::char_traits<char16_t>::length( s );
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CXX11_CHAR32_T
|
||||
inline std::size_t length( const char32_t* s )
|
||||
{
|
||||
return std::char_traits<char32_t>::length( s );
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
inline std::size_t length( const wchar_t* s )
|
||||
{
|
||||
@ -61,6 +76,30 @@ namespace boost
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CXX11_CHAR16_T
|
||||
inline bool is_char_ptr( char16_t* )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool is_char_ptr( const char16_t* )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CXX11_CHAR32_T
|
||||
inline bool is_char_ptr( char32_t* )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool is_char_ptr( const char32_t* )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
inline bool is_char_ptr( wchar_t* )
|
||||
{
|
||||
@ -122,6 +161,4 @@ namespace boost
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
#endif
|
||||
|
@ -17,16 +17,14 @@
|
||||
|
||||
#include <boost/range/config.hpp>
|
||||
|
||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
#include <boost/range/detail/begin.hpp>
|
||||
#else
|
||||
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
namespace range_detail
|
||||
{
|
||||
#endif
|
||||
@ -36,7 +34,7 @@ namespace range_detail
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename C >
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<C>::type
|
||||
BOOST_CONSTEXPR inline BOOST_DEDUCED_TYPENAME range_iterator<C>::type
|
||||
range_begin( C& c )
|
||||
{
|
||||
//
|
||||
@ -52,13 +50,13 @@ namespace range_detail
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename Iterator >
|
||||
inline Iterator range_begin( const std::pair<Iterator,Iterator>& p )
|
||||
BOOST_CONSTEXPR inline Iterator range_begin( const std::pair<Iterator,Iterator>& p )
|
||||
{
|
||||
return p.first;
|
||||
}
|
||||
|
||||
template< typename Iterator >
|
||||
inline Iterator range_begin( std::pair<Iterator,Iterator>& p )
|
||||
BOOST_CONSTEXPR inline Iterator range_begin( std::pair<Iterator,Iterator>& p )
|
||||
{
|
||||
return p.first;
|
||||
}
|
||||
@ -71,19 +69,19 @@ namespace range_detail
|
||||
// May this be discarded? Or is it needed for bad compilers?
|
||||
//
|
||||
template< typename T, std::size_t sz >
|
||||
inline const T* range_begin( const T (&a)[sz] )
|
||||
BOOST_CONSTEXPR inline const T* range_begin( const T (&a)[sz] ) BOOST_NOEXCEPT
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
template< typename T, std::size_t sz >
|
||||
inline T* range_begin( T (&a)[sz] )
|
||||
BOOST_CONSTEXPR inline T* range_begin( T (&a)[sz] ) BOOST_NOEXCEPT
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
} // namespace 'range_detail'
|
||||
#endif
|
||||
|
||||
@ -94,18 +92,24 @@ namespace range_adl_barrier
|
||||
{
|
||||
|
||||
template< class T >
|
||||
#if !BOOST_WORKAROUND(BOOST_GCC, < 40700)
|
||||
BOOST_CONSTEXPR
|
||||
#endif
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type begin( T& r )
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
using namespace range_detail;
|
||||
#endif
|
||||
return range_begin( r );
|
||||
}
|
||||
|
||||
template< class T >
|
||||
#if !BOOST_WORKAROUND(BOOST_GCC, < 40700)
|
||||
BOOST_CONSTEXPR
|
||||
#endif
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type begin( const T& r )
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
using namespace range_detail;
|
||||
#endif
|
||||
return range_begin( r );
|
||||
@ -114,8 +118,6 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type begin( const T& r )
|
||||
} // namespace range_adl_barrier
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_adl_barrier
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include <boost/range/detail/misc_concept.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \brief Concept checks for the Boost Range library.
|
||||
@ -82,7 +84,7 @@ namespace boost {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#ifdef BOOST_BORLANDC
|
||||
#define BOOST_RANGE_ENABLE_CONCEPT_ASSERT 0
|
||||
#endif
|
||||
|
||||
@ -164,10 +166,10 @@ namespace boost {
|
||||
// work
|
||||
(void)(i++);
|
||||
|
||||
BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::reference r1(*i);
|
||||
BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::reference r1(*i);
|
||||
boost::ignore_unused_variable_warning(r1);
|
||||
|
||||
BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::reference r2(*(++i));
|
||||
BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::reference r2(*(++i));
|
||||
boost::ignore_unused_variable_warning(r2);
|
||||
}
|
||||
private:
|
||||
@ -181,7 +183,7 @@ namespace boost {
|
||||
, DefaultConstructible<Iterator>
|
||||
{
|
||||
#if BOOST_RANGE_ENABLE_CONCEPT_ASSERT
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::difference_type difference_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::difference_type difference_type;
|
||||
|
||||
BOOST_MPL_ASSERT((is_integral<difference_type>));
|
||||
BOOST_MPL_ASSERT_RELATION(std::numeric_limits<difference_type>::is_signed, ==, true);
|
||||
@ -200,7 +202,7 @@ namespace boost {
|
||||
// is convertible to reference.
|
||||
Iterator i2(i++);
|
||||
boost::ignore_unused_variable_warning(i2);
|
||||
BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits<Iterator>::reference r(*(i++));
|
||||
BOOST_DEDUCED_TYPENAME std::iterator_traits<Iterator>::reference r(*(i++));
|
||||
boost::ignore_unused_variable_warning(r);
|
||||
}
|
||||
private:
|
||||
@ -250,7 +252,7 @@ namespace boost {
|
||||
n = i - j;
|
||||
}
|
||||
private:
|
||||
BOOST_DEDUCED_TYPENAME RandomAccessIteratorConcept::difference_type n;
|
||||
BOOST_DEDUCED_TYPENAME BidirectionalIteratorConcept<Iterator>::difference_type n;
|
||||
Iterator i;
|
||||
Iterator j;
|
||||
#endif
|
||||
|
@ -23,7 +23,7 @@
|
||||
#error "macro already defined!"
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
# define BOOST_RANGE_DEDUCED_TYPENAME typename
|
||||
#else
|
||||
#define BOOST_RANGE_DEDUCED_TYPENAME BOOST_DEDUCED_TYPENAME
|
||||
|
@ -36,7 +36,7 @@ namespace boost
|
||||
BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( const_iterator )
|
||||
|
||||
template< typename C >
|
||||
struct range_const_iterator
|
||||
struct range_const_iterator_helper
|
||||
: extract_const_iterator<C>
|
||||
{};
|
||||
|
||||
@ -45,7 +45,7 @@ struct range_const_iterator
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename Iterator >
|
||||
struct range_const_iterator<std::pair<Iterator,Iterator> >
|
||||
struct range_const_iterator_helper<std::pair<Iterator,Iterator> >
|
||||
{
|
||||
typedef Iterator type;
|
||||
};
|
||||
@ -55,7 +55,7 @@ struct range_const_iterator<std::pair<Iterator,Iterator> >
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename T, std::size_t sz >
|
||||
struct range_const_iterator< T[sz] >
|
||||
struct range_const_iterator_helper< T[sz] >
|
||||
{
|
||||
typedef const T* type;
|
||||
};
|
||||
@ -64,7 +64,7 @@ struct range_const_iterator< T[sz] >
|
||||
|
||||
template<typename C, typename Enabler=void>
|
||||
struct range_const_iterator
|
||||
: range_detail::range_const_iterator<
|
||||
: range_detail::range_const_iterator_helper<
|
||||
BOOST_DEDUCED_TYPENAME remove_reference<C>::type
|
||||
>
|
||||
{
|
||||
|
@ -15,6 +15,10 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config/header_deprecated.hpp>
|
||||
|
||||
BOOST_HEADER_DEPRECATED("<boost/range/reverse_iterator.hpp>")
|
||||
|
||||
#include <boost/range/reverse_iterator.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
@ -12,8 +12,7 @@
|
||||
|
||||
#include <boost/range/detail/any_iterator_buffer.hpp>
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
@ -35,15 +34,16 @@ namespace boost
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct mutable_reference_type_generator
|
||||
struct reference_as_value_type_generator
|
||||
{
|
||||
typedef typename remove_reference<
|
||||
typename remove_const<T>::type
|
||||
>::type value_type;
|
||||
|
||||
typedef typename mpl::if_<
|
||||
typename mpl::and_<
|
||||
typename is_const<T>::type,
|
||||
typename mpl::not_<typename is_reference<T>::type>::type
|
||||
>::type,
|
||||
T,
|
||||
typename add_reference<T>::type
|
||||
typename is_convertible<const value_type&, value_type>::type,
|
||||
value_type,
|
||||
T
|
||||
>::type type;
|
||||
};
|
||||
|
||||
@ -53,16 +53,12 @@ namespace boost
|
||||
>
|
||||
struct any_incrementable_iterator_interface
|
||||
{
|
||||
typedef typename mutable_reference_type_generator<
|
||||
Reference
|
||||
>::type reference;
|
||||
|
||||
typedef Reference reference;
|
||||
typedef typename const_reference_type_generator<
|
||||
Reference
|
||||
>::type const_reference;
|
||||
|
||||
typedef typename remove_const<
|
||||
typename remove_reference<Reference>::type
|
||||
typedef typename reference_as_value_type_generator<
|
||||
Reference
|
||||
>::type reference_as_value_type;
|
||||
|
||||
typedef Buffer buffer_type;
|
||||
|
@ -10,7 +10,7 @@
|
||||
#ifndef BOOST_RANGE_DETAIL_ANY_ITERATOR_WRAPPER_HPP_INCLUDED
|
||||
#define BOOST_RANGE_DETAIL_ANY_ITERATOR_WRAPPER_HPP_INCLUDED
|
||||
|
||||
#include <boost/cast.hpp>
|
||||
#include <boost/polymorphic_cast.hpp>
|
||||
#include <boost/range/config.hpp>
|
||||
#include <boost/range/detail/any_iterator_interface.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
|
@ -1,33 +0,0 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2006. 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)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
|
||||
#ifndef BOOST_RANGE_DETAIL_AS_LITERAL_HPP
|
||||
#define BOOST_RANGE_DETAIL_AS_LITERAL_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/range/detail/detail_str.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template< class Range >
|
||||
inline iterator_range<BOOST_DEDUCED_TYPENAME range_iterator<Range>::type>
|
||||
as_literal( Range& r )
|
||||
{
|
||||
return ::boost::make_iterator_range( ::boost::range_detail::str_begin(r),
|
||||
::boost::range_detail::str_end(r) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,83 +0,0 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2004. 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)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
|
||||
#ifndef BOOST_RANGE_DETAIL_BEGIN_HPP
|
||||
#define BOOST_RANGE_DETAIL_BEGIN_HPP
|
||||
|
||||
#include <boost/config.hpp> // BOOST_MSVC
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/range/detail/common.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace range_detail
|
||||
{
|
||||
template< typename T >
|
||||
struct range_begin;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// default
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<>
|
||||
struct range_begin<std_container_>
|
||||
{
|
||||
template< typename C >
|
||||
static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type fun( C& c )
|
||||
{
|
||||
return c.begin();
|
||||
};
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// pair
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<>
|
||||
struct range_begin<std_pair_>
|
||||
{
|
||||
template< typename P >
|
||||
static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<P>::type fun( const P& p )
|
||||
{
|
||||
return p.first;
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// array
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<>
|
||||
struct range_begin<array_>
|
||||
{
|
||||
template<typename T>
|
||||
static BOOST_RANGE_DEDUCED_TYPENAME range_value<T>::type* fun(T& t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace 'range_detail'
|
||||
|
||||
namespace range_adl_barrier
|
||||
{
|
||||
template< typename C >
|
||||
inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
|
||||
begin( C& c )
|
||||
{
|
||||
return range_detail::range_begin< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c );
|
||||
}
|
||||
}
|
||||
} // namespace 'boost'
|
||||
|
||||
|
||||
#endif
|
@ -187,8 +187,6 @@ namespace boost {
|
||||
return collection_traits<C>::function_type::empty( c );
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
//! Free-standing begin() function
|
||||
/*!
|
||||
Get the begin iterator of the container. Uses collection_traits.
|
||||
@ -233,32 +231,6 @@ namespace boost {
|
||||
return collection_traits<C>::function_type::end( c );
|
||||
}
|
||||
|
||||
#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
//! Free-standing begin() function
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template< typename C >
|
||||
inline typename collection_traits<C>::result_iterator
|
||||
begin( C& c )
|
||||
{
|
||||
return collection_traits<C>::function_type::begin( c );
|
||||
}
|
||||
|
||||
//! Free-standing end() function
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template< typename C >
|
||||
inline typename collection_traits<C>::result_iterator
|
||||
end( C& c )
|
||||
{
|
||||
return collection_traits<C>::function_type::end( c );
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <iterator>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
@ -22,7 +24,6 @@
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/mpl/fold.hpp>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
|
||||
// Container traits implementation ---------------------------------------------------------
|
||||
|
||||
@ -36,7 +37,7 @@ namespace boost {
|
||||
/*
|
||||
Wraps std::container compliant containers
|
||||
*/
|
||||
template< typename ContainerT >
|
||||
template< typename ContainerT >
|
||||
struct default_container_traits
|
||||
{
|
||||
typedef typename ContainerT::value_type value_type;
|
||||
@ -49,7 +50,7 @@ namespace boost {
|
||||
>::type result_iterator;
|
||||
typedef typename ContainerT::difference_type difference_type;
|
||||
typedef typename ContainerT::size_type size_type;
|
||||
|
||||
|
||||
// static operations
|
||||
template< typename C >
|
||||
static size_type size( const C& c )
|
||||
@ -63,8 +64,6 @@ namespace boost {
|
||||
return c.empty();
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template< typename C >
|
||||
static iterator begin( C& c )
|
||||
{
|
||||
@ -89,22 +88,6 @@ namespace boost {
|
||||
return c.end();
|
||||
}
|
||||
|
||||
#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template< typename C >
|
||||
static result_iterator begin( C& c )
|
||||
{
|
||||
return c.begin();
|
||||
}
|
||||
|
||||
template< typename C >
|
||||
static result_iterator end( C& c )
|
||||
{
|
||||
return c.end();
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
@ -138,11 +121,11 @@ namespace boost {
|
||||
{
|
||||
typedef typename PairT::first_type element_type;
|
||||
|
||||
typedef typename ::boost::detail::
|
||||
iterator_traits<element_type>::value_type value_type;
|
||||
typedef typename
|
||||
std::iterator_traits<element_type>::value_type value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef typename ::boost::detail::
|
||||
iterator_traits<element_type>::difference_type difference_type;
|
||||
typedef typename
|
||||
std::iterator_traits<element_type>::difference_type difference_type;
|
||||
|
||||
typedef element_type iterator;
|
||||
typedef element_type const_iterator;
|
||||
@ -204,7 +187,7 @@ namespace boost {
|
||||
BOOST_STATIC_CONSTANT( size_type, array_size = sz );
|
||||
};
|
||||
|
||||
|
||||
|
||||
// array length resolving
|
||||
/*
|
||||
Lenght of string contained in a static array could
|
||||
@ -261,7 +244,7 @@ namespace boost {
|
||||
else
|
||||
return std::char_traits<char>::length(a);
|
||||
}
|
||||
|
||||
|
||||
template< typename A >
|
||||
static bool empty( const A& a )
|
||||
{
|
||||
@ -321,7 +304,7 @@ namespace boost {
|
||||
const_iterator,
|
||||
iterator
|
||||
>::type result_iterator;
|
||||
|
||||
|
||||
private:
|
||||
// resolve array size
|
||||
typedef typename
|
||||
@ -345,9 +328,7 @@ namespace boost {
|
||||
{
|
||||
return array_length_type::empty(a);
|
||||
}
|
||||
|
||||
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template< typename A >
|
||||
static iterator begin( A& a )
|
||||
@ -373,22 +354,6 @@ namespace boost {
|
||||
return a+array_length_type::length(a);
|
||||
}
|
||||
|
||||
#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template< typename A >
|
||||
static result_iterator begin( A& a )
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
template< typename A >
|
||||
static result_iterator end( A& a )
|
||||
{
|
||||
return a+array_length_type::length(a);
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
@ -436,8 +401,6 @@ namespace boost {
|
||||
return p==0 || p[0]==0;
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template< typename P >
|
||||
static iterator begin( P& p )
|
||||
{
|
||||
@ -468,24 +431,6 @@ namespace boost {
|
||||
return p+char_traits::length(p);
|
||||
}
|
||||
|
||||
#else // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template< typename P >
|
||||
static result_iterator begin( P& p )
|
||||
{
|
||||
return p;
|
||||
}
|
||||
|
||||
template< typename P >
|
||||
static result_iterator end( P& p )
|
||||
{
|
||||
if ( p==0 )
|
||||
return p;
|
||||
else
|
||||
return p+char_traits::length(p);
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
@ -23,68 +23,20 @@
|
||||
#include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
#include <boost/preprocessor/arithmetic/div.hpp>
|
||||
#include <boost/preprocessor/arithmetic/mul.hpp>
|
||||
#include <boost/preprocessor/control.hpp>
|
||||
#include <boost/preprocessor/control/if.hpp>
|
||||
#include <boost/preprocessor/control/while.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
#include <boost/preprocessor/facilities/identity.hpp>
|
||||
#include <boost/preprocessor/iteration/local.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma.hpp>
|
||||
#include <boost/preprocessor/repetition.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/mpl/transform.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
|
||||
template<typename F, typename T, int SIZE>
|
||||
struct combined_result_impl;
|
||||
|
||||
template<typename F, typename T>
|
||||
struct combined_result
|
||||
: combined_result_impl<F, T, tuples::length<T>::value>
|
||||
{
|
||||
};
|
||||
|
||||
#define BOOST_RANGE_combined_element(z, n, data) \
|
||||
typename tuples::element<n, T>::type
|
||||
|
||||
#define BOOST_RANGE_combined_result(z, n, data) \
|
||||
template<typename F, typename T> \
|
||||
struct combined_result_impl <F,T,n> \
|
||||
: result_of<F(BOOST_PP_ENUM(n, BOOST_RANGE_combined_element, ~))> \
|
||||
{ \
|
||||
};
|
||||
|
||||
#define BOOST_PP_LOCAL_MACRO(n) BOOST_RANGE_combined_result(~,n,~)
|
||||
|
||||
#define BOOST_PP_LOCAL_LIMITS (BOOST_RANGE_MIN_COMBINE_ARGS, \
|
||||
BOOST_RANGE_MAX_COMBINE_ARGS)
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
#define BOOST_RANGE_combined_get(z, n, data) get<n>(tuple)
|
||||
|
||||
#define BOOST_RANGE_combined_unpack(z, n, data) \
|
||||
template<typename F, typename T> inline \
|
||||
typename combined_result<F,T>::type \
|
||||
unpack_(mpl::int_<n>, F f, const T& tuple) \
|
||||
{ \
|
||||
return f(BOOST_PP_ENUM(n, BOOST_RANGE_combined_get, ~)); \
|
||||
}
|
||||
|
||||
#define BOOST_PP_LOCAL_MACRO(n) BOOST_RANGE_combined_unpack(~,n,~)
|
||||
#define BOOST_PP_LOCAL_LIMITS (BOOST_RANGE_MIN_COMBINE_ARGS, \
|
||||
BOOST_RANGE_MAX_COMBINE_ARGS)
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
} // namespace range_detail
|
||||
|
||||
namespace range
|
||||
{
|
||||
@ -114,10 +66,6 @@ namespace range
|
||||
|
||||
#endif // include guard
|
||||
|
||||
#undef BOOST_RANGE_combined_element
|
||||
#undef BOOST_RANGE_combined_result
|
||||
#undef BOOST_RANGE_combined_get
|
||||
#undef BOOST_RANGE_combined_unpack
|
||||
#undef BOOST_RANGE_combined_seq
|
||||
#undef BOOST_RANGE_combined_exp_pred
|
||||
#undef BOOST_RANGE_combined_exp_op
|
||||
|
@ -15,8 +15,6 @@
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/iterator/zip_iterator.hpp>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <boost/range/config.hpp>
|
||||
#include <boost/range/detail/sfinae.hpp>
|
||||
#include <boost/type_traits/is_void.hpp>
|
||||
#include <boost/type_traits/detail/ice_or.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <cstddef>
|
||||
@ -70,7 +69,7 @@ namespace boost
|
||||
BOOST_STATIC_CONSTANT( bool, is_const_wchar_t_ptr_ = sizeof( boost::range_detail::is_const_wchar_t_ptr_impl( ptr ) ) == sizeof( yes_type ) );
|
||||
BOOST_STATIC_CONSTANT( bool, is_char_array_ = sizeof( boost::range_detail::is_char_array_impl( ptr ) ) == sizeof( yes_type ) );
|
||||
BOOST_STATIC_CONSTANT( bool, is_wchar_t_array_ = sizeof( boost::range_detail::is_wchar_t_array_impl( ptr ) ) == sizeof( yes_type ) );
|
||||
BOOST_STATIC_CONSTANT( bool, is_string_ = (boost::type_traits::ice_or<is_const_char_ptr_, is_const_wchar_t_ptr_>::value ));
|
||||
BOOST_STATIC_CONSTANT( bool, is_string_ = (is_const_char_ptr_ || is_const_wchar_t_ptr_));
|
||||
BOOST_STATIC_CONSTANT( bool, is_array_ = boost::is_array<C>::value );
|
||||
|
||||
};
|
||||
|
@ -32,6 +32,23 @@ public:
|
||||
: m_impl(source)
|
||||
{
|
||||
}
|
||||
default_constructible_unary_fn_wrapper(const default_constructible_unary_fn_wrapper& source)
|
||||
: m_impl(source.m_impl)
|
||||
{
|
||||
}
|
||||
default_constructible_unary_fn_wrapper& operator=(const default_constructible_unary_fn_wrapper& source)
|
||||
{
|
||||
if (source.m_impl)
|
||||
{
|
||||
// Lambda are not copy/move assignable.
|
||||
m_impl.emplace(*source.m_impl);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_impl.reset();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
template<typename Arg>
|
||||
R operator()(const Arg& arg) const
|
||||
{
|
||||
|
@ -1,376 +0,0 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2004. 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)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
|
||||
#ifndef BOOST_RANGE_DETAIL_DETAIL_STR_HPP
|
||||
#define BOOST_RANGE_DETAIL_DETAIL_STR_HPP
|
||||
|
||||
#include <boost/config.hpp> // BOOST_MSVC
|
||||
#include <boost/range/iterator.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace range_detail
|
||||
{
|
||||
//
|
||||
// iterator
|
||||
//
|
||||
|
||||
template<>
|
||||
struct range_iterator_<char_array_>
|
||||
{
|
||||
template< typename T >
|
||||
struct pts
|
||||
{
|
||||
typedef BOOST_RANGE_DEDUCED_TYPENAME
|
||||
remove_extent<T>::type* type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_iterator_<char_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef char* type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_iterator_<const_char_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef const char* type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_iterator_<wchar_t_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef wchar_t* type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_iterator_<const_wchar_t_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef const wchar_t* type;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// const iterator
|
||||
//
|
||||
|
||||
template<>
|
||||
struct range_const_iterator_<char_array_>
|
||||
{
|
||||
template< typename T >
|
||||
struct pts
|
||||
{
|
||||
typedef const BOOST_RANGE_DEDUCED_TYPENAME
|
||||
remove_extent<T>::type* type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_const_iterator_<char_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef const char* type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_const_iterator_<const_char_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef const char* type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_const_iterator_<wchar_t_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef const wchar_t* type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_const_iterator_<const_wchar_t_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef const wchar_t* type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#include <boost/range/detail/begin.hpp>
|
||||
#include <boost/range/detail/end.hpp>
|
||||
#include <boost/range/detail/size_type.hpp>
|
||||
#include <boost/range/detail/value_type.hpp>
|
||||
#include <boost/range/detail/common.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace range_detail
|
||||
{
|
||||
//
|
||||
// str_begin()
|
||||
//
|
||||
template<>
|
||||
struct range_begin<char_ptr_>
|
||||
{
|
||||
static char* fun( char* s )
|
||||
{
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_begin<const_char_ptr_>
|
||||
{
|
||||
static const char* fun( const char* s )
|
||||
{
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_begin<wchar_t_ptr_>
|
||||
{
|
||||
|
||||
static wchar_t* fun( wchar_t* s )
|
||||
{
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_begin<const_wchar_t_ptr_>
|
||||
{
|
||||
static const wchar_t* fun( const wchar_t* s )
|
||||
{
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
template< typename C >
|
||||
inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
|
||||
str_begin( C& c )
|
||||
{
|
||||
return range_detail::range_begin< BOOST_RANGE_DEDUCED_TYPENAME
|
||||
range_detail::range<C>::type >::fun( c );
|
||||
}
|
||||
|
||||
//
|
||||
// str_end()
|
||||
//
|
||||
|
||||
template<>
|
||||
struct range_end<char_array_>
|
||||
{
|
||||
template< typename T, std::size_t sz >
|
||||
static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||
{
|
||||
return boost::range_detail::array_end( boost_range_array );
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_end<wchar_t_array_>
|
||||
{
|
||||
template< typename T, std::size_t sz >
|
||||
static T* fun( T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||
{
|
||||
return boost::range_detail::array_end( boost_range_array );
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_end<char_ptr_>
|
||||
{
|
||||
static char* fun( char* s )
|
||||
{
|
||||
return boost::range_detail::str_end( s );
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_end<const_char_ptr_>
|
||||
{
|
||||
static const char* fun( const char* s )
|
||||
{
|
||||
return boost::range_detail::str_end( s );
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_end<wchar_t_ptr_>
|
||||
{
|
||||
static wchar_t* fun( wchar_t* s )
|
||||
{
|
||||
return boost::range_detail::str_end( s );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<>
|
||||
struct range_end<const_wchar_t_ptr_>
|
||||
{
|
||||
static const wchar_t* fun( const wchar_t* s )
|
||||
{
|
||||
return boost::range_detail::str_end( s );
|
||||
}
|
||||
};
|
||||
|
||||
template< typename C >
|
||||
inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
|
||||
str_end( C& c )
|
||||
{
|
||||
return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME
|
||||
range_detail::range<C>::type >::fun( c );
|
||||
}
|
||||
|
||||
//
|
||||
// size_type
|
||||
//
|
||||
|
||||
template<>
|
||||
struct range_size_type_<char_array_>
|
||||
{
|
||||
template< typename A >
|
||||
struct pts
|
||||
{
|
||||
typedef std::size_t type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_size_type_<char_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef std::size_t type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_size_type_<const_char_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef std::size_t type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_size_type_<wchar_t_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef std::size_t type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_size_type_<const_wchar_t_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef std::size_t type;
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// value_type
|
||||
//
|
||||
|
||||
template<>
|
||||
struct range_value_type_<char_array_>
|
||||
{
|
||||
template< typename T >
|
||||
struct pts
|
||||
{
|
||||
typedef char type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_value_type_<char_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef char type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_value_type_<const_char_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef const char type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_value_type_<wchar_t_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef wchar_t type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_value_type_<const_wchar_t_ptr_>
|
||||
{
|
||||
template< typename S >
|
||||
struct pts
|
||||
{
|
||||
typedef const wchar_t type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace 'range_detail'
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
|
||||
#endif
|
@ -1,86 +0,0 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2004. 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)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
|
||||
#ifndef BOOST_RANGE_DETAIL_END_HPP
|
||||
#define BOOST_RANGE_DETAIL_END_HPP
|
||||
|
||||
#include <boost/config.hpp> // BOOST_MSVC
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/range/detail/implementation_help.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/range/detail/common.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template< typename T >
|
||||
struct range_end;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// default
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<>
|
||||
struct range_end<std_container_>
|
||||
{
|
||||
template< typename C >
|
||||
static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
|
||||
fun( C& c )
|
||||
{
|
||||
return c.end();
|
||||
};
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// pair
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<>
|
||||
struct range_end<std_pair_>
|
||||
{
|
||||
template< typename P >
|
||||
static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<P>::type
|
||||
fun( const P& p )
|
||||
{
|
||||
return p.second;
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// array
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<>
|
||||
struct range_end<array_>
|
||||
{
|
||||
template<typename T>
|
||||
static BOOST_RANGE_DEDUCED_TYPENAME remove_extent<T>::type* fun(T& t)
|
||||
{
|
||||
return t + remove_extent<T>::size;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace 'range_detail'
|
||||
|
||||
namespace range_adl_barrier
|
||||
{
|
||||
template< typename C >
|
||||
inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
|
||||
end( C& c )
|
||||
{
|
||||
return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type >::fun( c );
|
||||
}
|
||||
} // namespace range_adl_barrier
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
#endif
|
@ -60,13 +60,13 @@ namespace boost
|
||||
}
|
||||
|
||||
template< class T, std::size_t sz >
|
||||
inline T* array_end( T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||
BOOST_CONSTEXPR inline T* array_end( T BOOST_RANGE_ARRAY_REF()[sz] ) BOOST_NOEXCEPT
|
||||
{
|
||||
return boost_range_array + sz;
|
||||
}
|
||||
|
||||
template< class T, std::size_t sz >
|
||||
inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz] )
|
||||
BOOST_CONSTEXPR inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz] ) BOOST_NOEXCEPT
|
||||
{
|
||||
return boost_range_array + sz;
|
||||
}
|
||||
|
@ -153,8 +153,12 @@ template<typename Iterator1
|
||||
typename iterator_reference<Iterator2>::type
|
||||
>::type
|
||||
>::value,
|
||||
typename add_const<
|
||||
typename iterator_reference<Iterator1>::type
|
||||
typename add_reference<
|
||||
typename add_const<
|
||||
typename remove_reference<
|
||||
typename iterator_reference<Iterator1>::type
|
||||
>::type
|
||||
>::type
|
||||
>::type,
|
||||
typename iterator_reference<Iterator1>::type
|
||||
>::type
|
||||
|
26
include/boost/range/detail/less.hpp
Normal file
26
include/boost/range/detail/less.hpp
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright 2019 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_RANGE_DETAIL_LESS
|
||||
#define BOOST_RANGE_DETAIL_LESS
|
||||
|
||||
namespace boost {
|
||||
namespace range {
|
||||
namespace detail {
|
||||
|
||||
struct less {
|
||||
template<class T, class U>
|
||||
bool operator()(const T& lhs, const U& rhs) const {
|
||||
return lhs < rhs;
|
||||
}
|
||||
};
|
||||
|
||||
} /* detail */
|
||||
} /* range */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
@ -58,6 +58,7 @@
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
#include <boost/utility/enable_if.hpp> // disable_if
|
||||
#include <boost/next_prior.hpp>
|
||||
|
||||
#if !defined(BOOST_RANGE_DETAIL_MICROSOFT_RANGE_VERSION_1)
|
||||
#include <boost/range/mutable_iterator.hpp>
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
@ -1,157 +0,0 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Jonathan Turkanis 2005. 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)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
|
||||
|
||||
#ifndef BOOST_RANGE_DETAIL_REMOVE_BOUNDS_HPP
|
||||
#define BOOST_RANGE_DETAIL_REMOVE_BOUNDS_HPP
|
||||
|
||||
#include <boost/config.hpp> // MSVC, NO_INTRINSIC_WCHAR_T, put size_t in std.
|
||||
#include <cstddef>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
|
||||
template< typename Case1 = mpl::true_,
|
||||
typename Type1 = mpl::void_,
|
||||
typename Case2 = mpl::true_,
|
||||
typename Type2 = mpl::void_,
|
||||
typename Case3 = mpl::true_,
|
||||
typename Type3 = mpl::void_,
|
||||
typename Case4 = mpl::true_,
|
||||
typename Type4 = mpl::void_,
|
||||
typename Case5 = mpl::true_,
|
||||
typename Type5 = mpl::void_,
|
||||
typename Case6 = mpl::true_,
|
||||
typename Type6 = mpl::void_,
|
||||
typename Case7 = mpl::true_,
|
||||
typename Type7 = mpl::void_,
|
||||
typename Case8 = mpl::true_,
|
||||
typename Type8 = mpl::void_,
|
||||
typename Case9 = mpl::true_,
|
||||
typename Type9 = mpl::void_,
|
||||
typename Case10 = mpl::true_,
|
||||
typename Type10 = mpl::void_,
|
||||
typename Case11 = mpl::true_,
|
||||
typename Type11 = mpl::void_,
|
||||
typename Case12 = mpl::true_,
|
||||
typename Type12 = mpl::void_,
|
||||
typename Case13 = mpl::true_,
|
||||
typename Type13 = mpl::void_,
|
||||
typename Case14 = mpl::true_,
|
||||
typename Type14 = mpl::void_,
|
||||
typename Case15 = mpl::true_,
|
||||
typename Type15 = mpl::void_,
|
||||
typename Case16 = mpl::true_,
|
||||
typename Type16 = mpl::void_,
|
||||
typename Case17 = mpl::true_,
|
||||
typename Type17 = mpl::void_,
|
||||
typename Case18 = mpl::true_,
|
||||
typename Type18 = mpl::void_,
|
||||
typename Case19 = mpl::true_,
|
||||
typename Type19 = mpl::void_,
|
||||
typename Case20 = mpl::true_,
|
||||
typename Type20 = mpl::void_>
|
||||
struct select {
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
Case1, mpl::identity<Type1>, mpl::eval_if<
|
||||
Case2, mpl::identity<Type2>, mpl::eval_if<
|
||||
Case3, mpl::identity<Type3>, mpl::eval_if<
|
||||
Case4, mpl::identity<Type4>, mpl::eval_if<
|
||||
Case5, mpl::identity<Type5>, mpl::eval_if<
|
||||
Case6, mpl::identity<Type6>, mpl::eval_if<
|
||||
Case7, mpl::identity<Type7>, mpl::eval_if<
|
||||
Case8, mpl::identity<Type8>, mpl::eval_if<
|
||||
Case9, mpl::identity<Type9>, mpl::if_<
|
||||
Case10, Type10, mpl::void_ > > > > > > > > >
|
||||
>::type result1;
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
Case11, mpl::identity<Type11>, mpl::eval_if<
|
||||
Case12, mpl::identity<Type12>, mpl::eval_if<
|
||||
Case13, mpl::identity<Type13>, mpl::eval_if<
|
||||
Case14, mpl::identity<Type14>, mpl::eval_if<
|
||||
Case15, mpl::identity<Type15>, mpl::eval_if<
|
||||
Case16, mpl::identity<Type16>, mpl::eval_if<
|
||||
Case17, mpl::identity<Type17>, mpl::eval_if<
|
||||
Case18, mpl::identity<Type18>, mpl::eval_if<
|
||||
Case19, mpl::identity<Type19>, mpl::if_<
|
||||
Case20, Type20, mpl::void_ > > > > > > > > >
|
||||
> result2;
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
is_same<result1, mpl::void_>,
|
||||
result2,
|
||||
mpl::identity<result1>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct remove_extent {
|
||||
static T* ar;
|
||||
BOOST_STATIC_CONSTANT(std::size_t, size = sizeof(*ar) / sizeof((*ar)[0]));
|
||||
|
||||
typedef typename
|
||||
select<
|
||||
is_same<T, bool[size]>, bool,
|
||||
is_same<T, char[size]>, char,
|
||||
is_same<T, signed char[size]>, signed char,
|
||||
is_same<T, unsigned char[size]>, unsigned char,
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
is_same<T, wchar_t[size]>, wchar_t,
|
||||
#endif
|
||||
is_same<T, short[size]>, short,
|
||||
is_same<T, unsigned short[size]>, unsigned short,
|
||||
is_same<T, int[size]>, int,
|
||||
is_same<T, unsigned int[size]>, unsigned int,
|
||||
is_same<T, long[size]>, long,
|
||||
is_same<T, unsigned long[size]>, unsigned long,
|
||||
is_same<T, float[size]>, float,
|
||||
is_same<T, double[size]>, double,
|
||||
is_same<T, long double[size]>, long double
|
||||
>::type result1;
|
||||
typedef typename
|
||||
select<
|
||||
is_same<T, const bool[size]>, const bool,
|
||||
is_same<T, const char[size]>, const char,
|
||||
is_same<T, const signed char[size]>, const signed char,
|
||||
is_same<T, const unsigned char[size]>, const unsigned char,
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
is_same<T, const wchar_t[size]>, const wchar_t,
|
||||
#endif
|
||||
is_same<T, const short[size]>, const short,
|
||||
is_same<T, const unsigned short[size]>, const unsigned short,
|
||||
is_same<T, const int[size]>, const int,
|
||||
is_same<T, const unsigned int[size]>, const unsigned int,
|
||||
is_same<T, const long[size]>, const long,
|
||||
is_same<T, const unsigned long[size]>, const unsigned long,
|
||||
is_same<T, const float[size]>, const float,
|
||||
is_same<T, const double[size]>, const double,
|
||||
is_same<T, const long double[size]>, const long double
|
||||
> result2;
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
is_same<result1, mpl::void_>,
|
||||
result2,
|
||||
mpl::identity<result1>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
} // namespace 'range_detail'
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
|
||||
#endif
|
@ -1,55 +0,0 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2004. 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)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
|
||||
#ifndef BOOST_RANGE_DETAIL_SIZE_TYPE_HPP
|
||||
#define BOOST_RANGE_DETAIL_SIZE_TYPE_HPP
|
||||
|
||||
#include <boost/range/detail/common.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// missing partial specialization workaround.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template< typename T >
|
||||
struct range_size_type_
|
||||
{
|
||||
template< typename C >
|
||||
struct pts
|
||||
{
|
||||
typedef std::size_t type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_size_type_<std_container_>
|
||||
{
|
||||
template< typename C >
|
||||
struct pts
|
||||
{
|
||||
typedef BOOST_RANGE_DEDUCED_TYPENAME C::size_type type;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
template< typename C >
|
||||
class range_size
|
||||
{
|
||||
typedef typename range_detail::range<C>::type c_type;
|
||||
public:
|
||||
typedef typename range_detail::range_size_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,72 +0,0 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2004. 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)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
|
||||
#ifndef BOOST_RANGE_DETAIL_VALUE_TYPE_HPP
|
||||
#define BOOST_RANGE_DETAIL_VALUE_TYPE_HPP
|
||||
|
||||
#include <boost/range/detail/common.hpp>
|
||||
#include <boost/range/detail/remove_extent.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// missing partial specialization workaround.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template< typename T >
|
||||
struct range_value_type_;
|
||||
|
||||
template<>
|
||||
struct range_value_type_<std_container_>
|
||||
{
|
||||
template< typename C >
|
||||
struct pts
|
||||
{
|
||||
typedef BOOST_RANGE_DEDUCED_TYPENAME C::value_type type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_value_type_<std_pair_>
|
||||
{
|
||||
template< typename P >
|
||||
struct pts
|
||||
{
|
||||
typedef BOOST_RANGE_DEDUCED_TYPENAME boost::iterator_value< BOOST_RANGE_DEDUCED_TYPENAME P::first_type >::type type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct range_value_type_<array_>
|
||||
{
|
||||
template< typename T >
|
||||
struct pts
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME remove_extent<T>::type type;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template< typename C >
|
||||
class range_value
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_detail::range<C>::type c_type;
|
||||
public:
|
||||
typedef BOOST_DEDUCED_TYPENAME range_detail::range_value_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -15,20 +15,32 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/range/config.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/range/has_range_iterator.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template< class T, bool B = has_type<range_iterator<T> >::value >
|
||||
struct range_difference
|
||||
{ };
|
||||
|
||||
template< class T >
|
||||
struct range_difference<T, true>
|
||||
: iterator_difference<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<T>::type
|
||||
>
|
||||
{ };
|
||||
}
|
||||
|
||||
template< class T >
|
||||
struct range_difference
|
||||
: iterator_difference<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<
|
||||
BOOST_DEDUCED_TYPENAME remove_reference<T>::type
|
||||
>::type
|
||||
>
|
||||
: range_detail::range_difference<BOOST_DEDUCED_TYPENAME remove_reference<T>::type>
|
||||
{ };
|
||||
}
|
||||
|
||||
|
@ -15,20 +15,26 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/iterator/distance.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/difference_type.hpp>
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template< class T >
|
||||
inline BOOST_DEDUCED_TYPENAME range_difference<T>::type
|
||||
distance( const T& r )
|
||||
namespace range_distance_adl_barrier
|
||||
{
|
||||
return std::distance( boost::begin( r ), boost::end( r ) );
|
||||
template< class T >
|
||||
inline BOOST_CXX14_CONSTEXPR BOOST_DEDUCED_TYPENAME range_difference<T>::type
|
||||
distance( const T& r )
|
||||
{
|
||||
return boost::iterators::distance( boost::begin( r ), boost::end( r ) );
|
||||
}
|
||||
}
|
||||
|
||||
using namespace range_distance_adl_barrier;
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
#endif
|
||||
|
@ -17,18 +17,16 @@
|
||||
|
||||
#include <boost/range/config.hpp>
|
||||
|
||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
#include <boost/range/detail/end.hpp>
|
||||
#else
|
||||
|
||||
#include <boost/range/detail/implementation_help.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
namespace range_detail
|
||||
{
|
||||
#endif
|
||||
@ -37,7 +35,7 @@ namespace range_detail
|
||||
// primary template
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
template< typename C >
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<C>::type
|
||||
BOOST_CONSTEXPR inline BOOST_DEDUCED_TYPENAME range_iterator<C>::type
|
||||
range_end( C& c )
|
||||
{
|
||||
//
|
||||
@ -53,13 +51,13 @@ namespace range_detail
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename Iterator >
|
||||
inline Iterator range_end( const std::pair<Iterator,Iterator>& p )
|
||||
BOOST_CONSTEXPR inline Iterator range_end( const std::pair<Iterator,Iterator>& p )
|
||||
{
|
||||
return p.second;
|
||||
}
|
||||
|
||||
template< typename Iterator >
|
||||
inline Iterator range_end( std::pair<Iterator,Iterator>& p )
|
||||
BOOST_CONSTEXPR inline Iterator range_end( std::pair<Iterator,Iterator>& p )
|
||||
{
|
||||
return p.second;
|
||||
}
|
||||
@ -69,18 +67,18 @@ namespace range_detail
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename T, std::size_t sz >
|
||||
inline const T* range_end( const T (&a)[sz] )
|
||||
BOOST_CONSTEXPR inline const T* range_end( const T (&a)[sz] ) BOOST_NOEXCEPT
|
||||
{
|
||||
return range_detail::array_end<T,sz>( a );
|
||||
}
|
||||
|
||||
template< typename T, std::size_t sz >
|
||||
inline T* range_end( T (&a)[sz] )
|
||||
BOOST_CONSTEXPR inline T* range_end( T (&a)[sz] ) BOOST_NOEXCEPT
|
||||
{
|
||||
return range_detail::array_end<T,sz>( a );
|
||||
}
|
||||
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
} // namespace 'range_detail'
|
||||
#endif
|
||||
|
||||
@ -88,18 +86,24 @@ namespace range_adl_barrier
|
||||
{
|
||||
|
||||
template< class T >
|
||||
#if !BOOST_WORKAROUND(BOOST_GCC, < 40700)
|
||||
BOOST_CONSTEXPR
|
||||
#endif
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type end( T& r )
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
using namespace range_detail;
|
||||
#endif
|
||||
return range_end( r );
|
||||
}
|
||||
|
||||
template< class T >
|
||||
#if !BOOST_WORKAROUND(BOOST_GCC, < 40700)
|
||||
BOOST_CONSTEXPR
|
||||
#endif
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type end( const T& r )
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
using namespace range_detail;
|
||||
#endif
|
||||
return range_end( r );
|
||||
@ -108,14 +112,12 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type end( const T& r )
|
||||
} // namespace range_adl_barrier
|
||||
} // namespace 'boost'
|
||||
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_adl_barrier
|
||||
{
|
||||
template< class T >
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type
|
||||
BOOST_CONSTEXPR inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type
|
||||
const_end( const T& r )
|
||||
{
|
||||
return boost::range_adl_barrier::end( r );
|
||||
|
@ -37,9 +37,9 @@ namespace boost
|
||||
T,
|
||||
BOOST_DEDUCED_TYPENAME ::boost::enable_if<
|
||||
BOOST_DEDUCED_TYPENAME mpl::eval_if<is_const<T>,
|
||||
has_type<range_const_iterator<
|
||||
has_type<boost::range_const_iterator<
|
||||
BOOST_DEDUCED_TYPENAME remove_const<T>::type> >,
|
||||
has_type<range_mutable_iterator<T> >
|
||||
has_type<boost::range_mutable_iterator<T> >
|
||||
>::type
|
||||
>::type
|
||||
>
|
||||
@ -57,7 +57,7 @@ namespace boost
|
||||
struct has_range_const_iterator_impl<
|
||||
T,
|
||||
BOOST_DEDUCED_TYPENAME ::boost::enable_if<
|
||||
has_type<range_const_iterator<T> >
|
||||
has_type<boost::range_const_iterator<T> >
|
||||
>::type
|
||||
>
|
||||
: boost::mpl::true_
|
||||
|
@ -217,7 +217,7 @@ namespace boost
|
||||
{
|
||||
BOOST_ASSERT( step_size != 0 );
|
||||
BOOST_ASSERT( (step_size > 0) ? (last >= first) : (last <= first) );
|
||||
|
||||
|
||||
typedef typename range_detail::integer_iterator_with_step<Integer> iterator_t;
|
||||
|
||||
const std::ptrdiff_t sz = static_cast<std::ptrdiff_t>(step_size >= 0 ? step_size : -step_size);
|
||||
@ -225,12 +225,19 @@ namespace boost
|
||||
const Integer f = step_size >= 0 ? first : last;
|
||||
const std::ptrdiff_t num_steps = (l - f) / sz + ((l - f) % sz ? 1 : 0);
|
||||
BOOST_ASSERT(num_steps >= 0);
|
||||
|
||||
|
||||
return strided_integer_range<Integer>(
|
||||
iterator_t(first, 0, step_size),
|
||||
iterator_t(first, num_steps, step_size));
|
||||
}
|
||||
|
||||
template<typename Integer>
|
||||
integer_range<Integer>
|
||||
irange(Integer last)
|
||||
{
|
||||
return integer_range<Integer>(static_cast<Integer>(0), last);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
|
@ -46,31 +46,29 @@ namespace boost
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template< typename C, typename Enabler=void >
|
||||
struct range_iterator
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
|
||||
|
||||
typedef BOOST_RANGE_DEDUCED_TYPENAME
|
||||
range_detail_vc7_1::range_iterator<C>::type type;
|
||||
|
||||
#else
|
||||
|
||||
private:
|
||||
typedef typename remove_reference<C>::type param_t;
|
||||
|
||||
public:
|
||||
typedef typename mpl::eval_if_c<
|
||||
is_const<param_t>::value,
|
||||
range_const_iterator<typename remove_const<param_t>::type>,
|
||||
range_mutable_iterator<param_t>
|
||||
>::type type;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#else
|
||||
|
||||
template< typename C, typename Enabler=void >
|
||||
struct range_iterator
|
||||
: mpl::if_c<
|
||||
is_const<typename remove_reference<C>::type>::value,
|
||||
range_const_iterator<typename remove_const<typename remove_reference<C>::type>::type>,
|
||||
range_mutable_iterator<typename remove_reference<C>::type>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <boost/range/algorithm/equal.hpp>
|
||||
#include <boost/range/detail/safe_bool.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
@ -66,13 +67,13 @@ namespace boost
|
||||
template< class ForwardRange >
|
||||
static IteratorT adl_begin( ForwardRange& r )
|
||||
{
|
||||
return static_cast<IteratorT>( boost::begin( r ) );
|
||||
return IteratorT( boost::begin( r ) );
|
||||
}
|
||||
|
||||
template< class ForwardRange >
|
||||
static IteratorT adl_end( ForwardRange& r )
|
||||
{
|
||||
return static_cast<IteratorT>( boost::end( r ) );
|
||||
return IteratorT( boost::end( r ) );
|
||||
}
|
||||
};
|
||||
|
||||
@ -636,8 +637,6 @@ public:
|
||||
return iterator_range_detail::greater_or_equal_than( l, r );
|
||||
}
|
||||
|
||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
#else
|
||||
template< class Iterator1T, class Iterator2T >
|
||||
inline bool
|
||||
operator==( const iterator_range<Iterator1T>& l, const iterator_range<Iterator2T>& r )
|
||||
@ -742,8 +741,6 @@ public:
|
||||
return iterator_range_detail::greater_or_equal_than( l, r );
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
// iterator range utilities -----------------------------------------//
|
||||
|
||||
//! iterator_range construct helper
|
||||
@ -768,17 +765,6 @@ public:
|
||||
return iterator_range<IteratorT>(first, boost::next(first, n));
|
||||
}
|
||||
|
||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template< typename Range >
|
||||
inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<Range>::type >
|
||||
make_iterator_range( Range& r )
|
||||
{
|
||||
return iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<Range>::type >
|
||||
( boost::begin( r ), boost::end( r ) );
|
||||
}
|
||||
|
||||
#else
|
||||
//! iterator_range construct helper
|
||||
/*!
|
||||
Construct an \c iterator_range from a \c Range containing the begin
|
||||
@ -800,8 +786,6 @@ public:
|
||||
( r, iterator_range_detail::const_range_tag() );
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
namespace iterator_range_detail
|
||||
{
|
||||
template< class Range >
|
||||
@ -826,19 +810,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template< class Range >
|
||||
inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<Range>::type >
|
||||
make_iterator_range( Range& r,
|
||||
BOOST_DEDUCED_TYPENAME range_difference<Range>::type advance_begin,
|
||||
BOOST_DEDUCED_TYPENAME range_difference<Range>::type advance_end )
|
||||
{
|
||||
return iterator_range_detail::make_range_impl( r, advance_begin, advance_end );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template< class Range >
|
||||
inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<Range>::type >
|
||||
make_iterator_range( Range& r,
|
||||
@ -857,8 +828,6 @@ public:
|
||||
return iterator_range_detail::make_range_impl( r, advance_begin, advance_end );
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
//! copy a range into a sequence
|
||||
/*!
|
||||
Construct a new sequence of the specified type from the elements
|
||||
|
@ -17,10 +17,7 @@
|
||||
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/range/has_range_iterator.hpp>
|
||||
#include <boost/range/result_iterator.hpp>
|
||||
#include <boost/range/reverse_iterator.hpp>
|
||||
#include <boost/range/const_reverse_iterator.hpp>
|
||||
#include <boost/range/reverse_result_iterator.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/range/size_type.hpp>
|
||||
#include <boost/range/difference_type.hpp>
|
||||
|
@ -292,11 +292,8 @@ namespace boost { namespace range_detail_microsoft {
|
||||
struct meta
|
||||
{
|
||||
typedef list_iterator<X, ::CObject *> mutable_iterator;
|
||||
#if !defined(BOOST_RANGE_MFC_CONST_COL_RETURNS_NON_REF)
|
||||
typedef list_iterator<X const, ::CObject const *> const_iterator;
|
||||
#else
|
||||
// const CObList and const CPtrList both return a value (and probably always will)
|
||||
typedef list_iterator<X const, ::CObject const * const, ::CObject const * const> const_iterator;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
@ -309,11 +306,8 @@ namespace boost { namespace range_detail_microsoft {
|
||||
struct meta
|
||||
{
|
||||
typedef list_iterator<X, void *> mutable_iterator;
|
||||
#if !defined(BOOST_RANGE_MFC_CONST_COL_RETURNS_NON_REF)
|
||||
typedef list_iterator<X const, void const *> const_iterator;
|
||||
#else
|
||||
// const CObList and const CPtrList both return a value (and probably always will)
|
||||
typedef list_iterator<X const, void const * const, void const * const> const_iterator;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -21,17 +21,6 @@
|
||||
namespace boost
|
||||
{
|
||||
|
||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template< class C >
|
||||
inline BOOST_DEDUCED_TYPENAME range_reverse_iterator<C>::type
|
||||
rbegin( C& c )
|
||||
{
|
||||
return BOOST_DEDUCED_TYPENAME range_reverse_iterator<C>::type( boost::end( c ) );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template< class C >
|
||||
inline BOOST_DEDUCED_TYPENAME range_reverse_iterator<C>::type
|
||||
rbegin( C& c )
|
||||
@ -50,8 +39,6 @@ rbegin( const C& c )
|
||||
return iter_type( boost::end( c ) );
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template< class T >
|
||||
inline BOOST_DEDUCED_TYPENAME range_reverse_iterator<const T>::type
|
||||
const_rbegin( const T& r )
|
||||
|
@ -21,17 +21,6 @@
|
||||
namespace boost
|
||||
{
|
||||
|
||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
template< class C >
|
||||
inline BOOST_DEDUCED_TYPENAME range_reverse_iterator<C>::type
|
||||
rend( C& c )
|
||||
{
|
||||
return BOOST_DEDUCED_TYPENAME range_reverse_iterator<C>::type( boost::begin( c ) );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template< class C >
|
||||
inline BOOST_DEDUCED_TYPENAME range_reverse_iterator<C>::type
|
||||
rend( C& c )
|
||||
@ -50,8 +39,6 @@ rend( const C& c )
|
||||
return iter_type( boost::begin( c ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template< class T >
|
||||
inline BOOST_DEDUCED_TYPENAME range_reverse_iterator<const T>::type
|
||||
const_rend( const T& r )
|
||||
|
@ -15,6 +15,10 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config/header_deprecated.hpp>
|
||||
|
||||
BOOST_HEADER_DEPRECATED("<boost/range/iterator.hpp>")
|
||||
|
||||
#include <boost/range/iterator.hpp>
|
||||
|
||||
namespace boost
|
||||
|
@ -15,6 +15,10 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config/header_deprecated.hpp>
|
||||
|
||||
BOOST_HEADER_DEPRECATED("<boost/range/reverse_iterator.hpp>")
|
||||
|
||||
#include <boost/range/reverse_iterator.hpp>
|
||||
|
||||
namespace boost
|
||||
|
@ -54,11 +54,20 @@ namespace boost
|
||||
inline typename range_size<const SinglePassRange>::type
|
||||
size(const SinglePassRange& rng)
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
|
||||
// Very strange things happen on some compilers that have the range concept
|
||||
// asserts disabled. This preprocessor condition is clearly redundant on a
|
||||
// working compiler but is vital for at least some compilers such as clang 4.2
|
||||
// but only on the Mac!
|
||||
#if BOOST_RANGE_ENABLE_CONCEPT_ASSERT == 1
|
||||
BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept<SinglePassRange>));
|
||||
#endif
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) && \
|
||||
!BOOST_WORKAROUND(__GNUC__, < 3) \
|
||||
/**/
|
||||
using namespace range_detail;
|
||||
#endif
|
||||
|
||||
return range_calculate_size(rng);
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <boost/range/config.hpp>
|
||||
#include <boost/range/difference_type.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/range/has_range_iterator.hpp>
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/make_unsigned.hpp>
|
||||
@ -51,7 +52,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template<typename C, typename Enabler=void>
|
||||
struct range_size
|
||||
struct range_size_
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME make_unsigned<
|
||||
BOOST_DEDUCED_TYPENAME range_difference<C>::type
|
||||
@ -59,7 +60,7 @@ namespace boost
|
||||
};
|
||||
|
||||
template<typename C>
|
||||
struct range_size<
|
||||
struct range_size_<
|
||||
C,
|
||||
BOOST_DEDUCED_TYPENAME ::boost::enable_if<has_size_type<C>, void>::type
|
||||
>
|
||||
@ -67,29 +68,20 @@ namespace boost
|
||||
typedef BOOST_DEDUCED_TYPENAME C::size_type type;
|
||||
};
|
||||
|
||||
template<typename C, bool B = range_detail::has_type< range_iterator<C> >::value>
|
||||
struct range_size
|
||||
{ };
|
||||
|
||||
template<typename C>
|
||||
struct range_size<C, true>
|
||||
: range_size_<C>
|
||||
{ };
|
||||
}
|
||||
|
||||
template< class T >
|
||||
struct range_size :
|
||||
detail::range_size<T>
|
||||
{
|
||||
// Very strange things happen on some compilers that have the range concept
|
||||
// asserts disabled. This preprocessor condition is clearly redundant on a
|
||||
// working compiler but is vital for at least some compilers such as clang 4.2
|
||||
// but only on the Mac!
|
||||
#if BOOST_RANGE_ENABLE_CONCEPT_ASSERT == 1
|
||||
BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept<T>));
|
||||
#endif
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct range_size<const T >
|
||||
: detail::range_size<T>
|
||||
{
|
||||
#if BOOST_RANGE_ENABLE_CONCEPT_ASSERT == 1
|
||||
BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept<T>));
|
||||
#endif
|
||||
};
|
||||
{ };
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
@ -182,8 +182,8 @@ public:
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500) )
|
||||
sub_range(const sub_range& r)
|
||||
: base(impl::adl_begin(static_cast<const base&>(r)),
|
||||
impl::adl_end(static_cast<const base&>(r)))
|
||||
: base(impl::adl_begin(const_cast<base&>(static_cast<const base&>(r))),
|
||||
impl::adl_end(const_cast<base&>(static_cast<const base&>(r))))
|
||||
{ }
|
||||
#endif
|
||||
|
||||
|
@ -12,5 +12,6 @@
|
||||
"maintainers": [
|
||||
"Neil Groves <neilgroves -at- googlemail.com>",
|
||||
"Nathan Ridge <zeratul976 -at- hotmail.com>"
|
||||
]
|
||||
],
|
||||
"cxxstd": "03"
|
||||
}
|
||||
|
@ -40,10 +40,6 @@ test-suite range :
|
||||
[ compile-fail compile_fail/adaptor/copied_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/copied_concept3.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/copied_concept4.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/filtered_concept.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/filtered_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/filtered_concept3.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/filtered_concept4.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/reversed_concept.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/reversed_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/reversed_concept3.cpp ]
|
||||
@ -63,6 +59,8 @@ test-suite range :
|
||||
[ range-test adaptor_test/indexed ]
|
||||
[ range-test adaptor_test/indirected ]
|
||||
[ range-test adaptor_test/map ]
|
||||
[ range-test adaptor_test/ref_unwrapped ]
|
||||
[ range-test adaptor_test/ref_unwrapped_example ]
|
||||
[ range-test adaptor_test/replaced ]
|
||||
[ range-test adaptor_test/replaced_if ]
|
||||
[ range-test adaptor_test/reversed ]
|
||||
@ -83,6 +81,7 @@ test-suite range :
|
||||
[ range-test adaptor_test/type_erased_forward ]
|
||||
[ range-test adaptor_test/type_erased_bidirectional ]
|
||||
[ range-test adaptor_test/type_erased_random_access ]
|
||||
[ range-test adaptor_test/type_erased_transformed ]
|
||||
[ range-test adaptor_test/uniqued ]
|
||||
[ range-test adaptor_test/adjacent_filtered_example ]
|
||||
[ range-test adaptor_test/copied_example ]
|
||||
@ -219,6 +218,9 @@ test-suite range :
|
||||
[ range-test ticket_5811_indirected_optional ]
|
||||
[ range-test ticket_6715_iterator_range_equality ]
|
||||
[ range-test ticket_6944 ]
|
||||
[ range-test ticket_10336 ]
|
||||
[ range-test value_type ]
|
||||
;
|
||||
|
||||
# `quick` target (for CI)
|
||||
alias quick : std_container ;
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <boost/range/adaptor/transformed.hpp>
|
||||
#include <boost/range/adaptor/filtered.hpp>
|
||||
#include <boost/range/algorithm/copy.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/bind/bind.hpp>
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
@ -88,6 +88,8 @@ void chained_adaptors_test()
|
||||
|
||||
std::set<foo> foos;
|
||||
|
||||
using namespace boost::placeholders;
|
||||
|
||||
boost::copy(sep
|
||||
| boost::adaptors::transformed(boost::bind(&foo::from_string, _1))
|
||||
| boost::adaptors::filtered(boost::bind(&foo::is_valid, _1)),
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -50,6 +51,23 @@ namespace boost
|
||||
bool operator()( IntegerT x ) const { return x % 2 != 0; }
|
||||
};
|
||||
|
||||
struct lambda_init
|
||||
{
|
||||
};
|
||||
|
||||
struct lambda
|
||||
{
|
||||
lambda(const lambda_init& init) {}
|
||||
lambda(const lambda& rhs) {}
|
||||
|
||||
template< class T1 >
|
||||
bool operator()(T1) const { return false; }
|
||||
|
||||
private:
|
||||
lambda() {}
|
||||
lambda& operator=(const lambda& rhs) { return *this; }
|
||||
};
|
||||
|
||||
template< class Container, class Pred >
|
||||
void filtered_test_impl( Container& c, Pred pred )
|
||||
{
|
||||
@ -85,32 +103,75 @@ namespace boost
|
||||
test_result2.end() );
|
||||
}
|
||||
|
||||
template< class Rng >
|
||||
void check_copy_assign(Rng r)
|
||||
{
|
||||
Rng r2 = r;
|
||||
r2 = r;
|
||||
}
|
||||
|
||||
template< class Container, class Pred >
|
||||
void filtered_range_copy_assign(Container& c, Pred pred)
|
||||
{
|
||||
using namespace boost::adaptors;
|
||||
check_copy_assign(c | filtered(pred));
|
||||
check_copy_assign(adaptors::filter(c, pred));
|
||||
}
|
||||
|
||||
template< class Container, class Pred, class PredInit >
|
||||
void filtered_test_impl()
|
||||
{
|
||||
using namespace boost::assign;
|
||||
|
||||
Container c;
|
||||
PredInit init;
|
||||
Pred pred(init);
|
||||
|
||||
// test empty container
|
||||
filtered_test_impl(c, Pred());
|
||||
filtered_test_impl(c, pred);
|
||||
|
||||
// test one element
|
||||
c += 1;
|
||||
filtered_test_impl(c, Pred());
|
||||
filtered_test_impl(c, pred);
|
||||
|
||||
// test many elements
|
||||
c += 1,2,2,2,3,4,4,4,4,5,6,7,8,9,9;
|
||||
filtered_test_impl(c, Pred());
|
||||
filtered_test_impl(c, pred);
|
||||
|
||||
// test the range and iterator are copy assignable
|
||||
filtered_range_copy_assign(c, pred);
|
||||
}
|
||||
|
||||
template< class Container >
|
||||
void filtered_test_all_predicates()
|
||||
{
|
||||
filtered_test_impl< Container, always_false_pred >();
|
||||
filtered_test_impl< Container, always_true_pred >();
|
||||
filtered_test_impl< Container, is_odd >();
|
||||
filtered_test_impl< Container, is_even >();
|
||||
filtered_test_impl< Container, always_false_pred, always_false_pred >();
|
||||
filtered_test_impl< Container, always_true_pred, always_true_pred >();
|
||||
filtered_test_impl< Container, is_odd, is_odd >();
|
||||
filtered_test_impl< Container, is_even, is_even >();
|
||||
filtered_test_impl< Container, lambda, lambda_init >();
|
||||
}
|
||||
|
||||
void ticket_10988_single_pass()
|
||||
{
|
||||
std::vector<int> v;
|
||||
std::string str("0 1 2 3 4 5");
|
||||
std::istringstream in(str);
|
||||
|
||||
boost::push_back(v,
|
||||
boost::make_iterator_range(
|
||||
std::istream_iterator<int>(in),
|
||||
std::istream_iterator<int>())
|
||||
| boost::adaptors::filtered(is_even()));
|
||||
|
||||
std::vector<int> reference;
|
||||
for (int i = 0; i < 6; i += 2)
|
||||
{
|
||||
reference.push_back(i);
|
||||
}
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(
|
||||
reference.begin(), reference.end(),
|
||||
v.begin(), v.end());
|
||||
}
|
||||
|
||||
void filtered_test()
|
||||
@ -119,6 +180,7 @@ namespace boost
|
||||
filtered_test_all_predicates< std::list< int > >();
|
||||
filtered_test_all_predicates< std::set< int > >();
|
||||
filtered_test_all_predicates< std::multiset< int > >();
|
||||
ticket_10988_single_pass();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
101
test/adaptor_test/ref_unwrapped.cpp
Normal file
101
test/adaptor_test/ref_unwrapped.cpp
Normal file
@ -0,0 +1,101 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Robin Eckert 2015. 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)
|
||||
//
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
#include <boost/range/adaptor/ref_unwrapped.hpp>
|
||||
|
||||
#define BOOST_TEST_MAIN
|
||||
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && !defined(BOOST_NO_CXX11_RANGE_BASED_FOR) && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_mutable)
|
||||
{
|
||||
int one = 1;
|
||||
int two = 2;
|
||||
int three = 3;
|
||||
|
||||
std::vector<std::reference_wrapper<int>> input_values{one, two, three};
|
||||
|
||||
const std::vector<int*> expected{&one, &two, &three};
|
||||
std::vector<int*> actual;
|
||||
|
||||
for (auto&& value : input_values | adaptors::ref_unwrapped)
|
||||
{
|
||||
actual.push_back(&value);
|
||||
}
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(expected.begin(),
|
||||
expected.end(),
|
||||
actual.begin(),
|
||||
actual.end());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_const_range)
|
||||
{
|
||||
int one = 1;
|
||||
int two = 2;
|
||||
int three = 3;
|
||||
|
||||
const std::vector<std::reference_wrapper<int>> input_values{one, two, three};
|
||||
|
||||
const std::vector<int*> expected{&one, &two, &three};
|
||||
std::vector<int*> actual;
|
||||
|
||||
for (auto&& value : input_values | adaptors::ref_unwrapped)
|
||||
{
|
||||
actual.push_back(&value);
|
||||
}
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(expected.begin(),
|
||||
expected.end(),
|
||||
actual.begin(),
|
||||
actual.end());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_const_reference)
|
||||
{
|
||||
const int one = 1;
|
||||
const int two = 2;
|
||||
const int three = 3;
|
||||
|
||||
const std::vector<std::reference_wrapper<const int>> input_values{one, two, three};
|
||||
|
||||
const std::vector<const int*> expected{&one, &two, &three};
|
||||
std::vector<const int*> actual;
|
||||
|
||||
for (auto&& value : input_values | adaptors::ref_unwrapped)
|
||||
{
|
||||
actual.push_back(&value);
|
||||
}
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(expected.begin(),
|
||||
expected.end(),
|
||||
actual.begin(),
|
||||
actual.end());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
BOOST_AUTO_TEST_CASE(empty)
|
||||
{
|
||||
// C++11 only
|
||||
}
|
||||
|
||||
#endif
|
47
test/adaptor_test/ref_unwrapped_example.cpp
Normal file
47
test/adaptor_test/ref_unwrapped_example.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Robin Eckert 2015. 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)
|
||||
//
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
//[ref_unwrapped_example
|
||||
#include <boost/range/adaptor/ref_unwrapped.hpp>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
struct example
|
||||
{
|
||||
int value;
|
||||
};
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
//<-
|
||||
#if !defined(BOOST_NO_CXX11_DECLTYPE) \
|
||||
&& !defined(BOOST_NO_CXX11_RANGE_BASED_FOR) \
|
||||
&& !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) \
|
||||
&& !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
|
||||
//->
|
||||
using boost::adaptors::ref_unwrapped;
|
||||
|
||||
example one{1};
|
||||
example two{2};
|
||||
example three{3};
|
||||
|
||||
std::vector<std::reference_wrapper<example> > input{one, two, three};
|
||||
|
||||
for (auto&& entry : input | ref_unwrapped)
|
||||
{
|
||||
std::cout << entry.value;
|
||||
}
|
||||
|
||||
return 0;
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
}
|
||||
//]
|
@ -9,7 +9,7 @@
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
// The strided_defect_Trac5014 test case is a modified version of a test case
|
||||
// contributed by Michel Morin as part of the trac ticket.
|
||||
// contributed by Maxim Yanchenko as part of the trac ticket.
|
||||
//
|
||||
// The deque test case has been removed due to erroneous standard library
|
||||
// implementations causing test failures.
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/bind/bind.hpp>
|
||||
#include <boost/range/algorithm_ext.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
@ -38,6 +38,24 @@ namespace boost
|
||||
int operator()(int x) const { return x / 2; }
|
||||
};
|
||||
|
||||
struct lambda_init
|
||||
{
|
||||
};
|
||||
|
||||
struct lambda
|
||||
{
|
||||
typedef int result_type;
|
||||
|
||||
lambda(const lambda_init& init) {}
|
||||
lambda(const lambda& rhs) {}
|
||||
|
||||
int operator()(int x) const { return x + 1; }
|
||||
|
||||
private:
|
||||
lambda() {}
|
||||
lambda& operator=(const lambda& rhs) { return *this; }
|
||||
};
|
||||
|
||||
template< class Container, class TransformFn >
|
||||
void transformed_test_impl_core( Container& c, TransformFn fn )
|
||||
{
|
||||
@ -59,13 +77,29 @@ namespace boost
|
||||
test_result2.begin(), test_result2.end() );
|
||||
}
|
||||
|
||||
template< class Rng >
|
||||
void check_copy_assign(Rng r)
|
||||
{
|
||||
Rng r2 = r;
|
||||
r2 = r;
|
||||
}
|
||||
|
||||
template< class Container, class TransformFn >
|
||||
void transformed_range_copy_assign(Container& c, TransformFn fn)
|
||||
{
|
||||
using namespace boost::adaptors;
|
||||
check_copy_assign(c | transformed(fn));
|
||||
check_copy_assign(adaptors::transform(c, fn));
|
||||
}
|
||||
|
||||
template< class Container, class TransformFn, class TransformFnInit >
|
||||
void transformed_test_fn_impl()
|
||||
{
|
||||
using namespace boost::assign;
|
||||
|
||||
Container c;
|
||||
TransformFn fn;
|
||||
TransformFnInit init;
|
||||
TransformFn fn( init );
|
||||
|
||||
// Test empty
|
||||
transformed_test_impl_core(c, fn);
|
||||
@ -77,13 +111,17 @@ namespace boost
|
||||
// Test many elements
|
||||
c += 1,1,1,2,2,2,2,2,3,4,5,6,7,8,9;
|
||||
transformed_test_impl_core(c, fn);
|
||||
|
||||
// test the range and iterator are copy assignable
|
||||
transformed_range_copy_assign(c, fn);
|
||||
}
|
||||
|
||||
template< class Container >
|
||||
void transformed_test_impl()
|
||||
{
|
||||
transformed_test_fn_impl< Container, double_x >();
|
||||
transformed_test_fn_impl< Container, halve_x >();
|
||||
transformed_test_fn_impl< Container, double_x, double_x >();
|
||||
transformed_test_fn_impl< Container, halve_x, halve_x >();
|
||||
transformed_test_fn_impl< Container, lambda, lambda_init >();
|
||||
}
|
||||
|
||||
void transformed_test()
|
||||
@ -102,6 +140,7 @@ namespace boost
|
||||
void transformed_bind()
|
||||
{
|
||||
using namespace boost::adaptors;
|
||||
using namespace boost::placeholders;
|
||||
|
||||
std::vector<foo_bind> input(5);
|
||||
std::vector<int> output;
|
||||
|
67
test/adaptor_test/type_erased_transformed.cpp
Normal file
67
test/adaptor_test/type_erased_transformed.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. 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)
|
||||
//
|
||||
#include <boost/range/adaptor/type_erased.hpp>
|
||||
#include <boost/range/adaptor/transformed.hpp>
|
||||
#include <boost/range/numeric.hpp>
|
||||
#include "type_erased_test.hpp"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost_range_adaptor_type_erased_test
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
typedef boost::any_range<
|
||||
int,
|
||||
boost::random_access_traversal_tag,
|
||||
int,
|
||||
std::ptrdiff_t
|
||||
> any_integer_value_range;
|
||||
|
||||
struct get_fn
|
||||
{
|
||||
typedef boost::int32_t result_type;
|
||||
boost::int32_t operator()(const MockType& val) const
|
||||
{
|
||||
return val.get();
|
||||
}
|
||||
};
|
||||
|
||||
int accumulate_any_integer_value_range(any_integer_value_range rng)
|
||||
{
|
||||
return boost::accumulate(rng, 0);
|
||||
}
|
||||
|
||||
void test_type_erased_transformed()
|
||||
{
|
||||
std::vector<MockType> v(5, MockType(3));
|
||||
|
||||
const int sum = accumulate_any_integer_value_range(
|
||||
v | boost::adaptors::transformed(get_fn()));
|
||||
|
||||
BOOST_CHECK_EQUAL(15, sum);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace boost_range_adaptor_type_erased_test
|
||||
|
||||
boost::unit_test::test_suite*
|
||||
init_unit_test_suite(int, char*[])
|
||||
{
|
||||
boost::unit_test::test_suite* test
|
||||
= BOOST_TEST_SUITE("RangeTestSuite.adaptor.type_erased_transformed");
|
||||
|
||||
test->add(
|
||||
BOOST_TEST_CASE(
|
||||
&boost_range_adaptor_type_erased_test::test_type_erased_transformed));
|
||||
|
||||
return test;
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
# pragma warn -8091 // suppress warning in Boost.Test
|
||||
# pragma warn -8057 // unused argument argc/argv in Boost.Test
|
||||
#endif
|
||||
|
@ -35,9 +35,8 @@
|
||||
#endif
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/range/numeric.hpp>
|
||||
#include <boost/range/algorithm.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
@ -457,7 +456,7 @@ void simple_compile_test()
|
||||
|
||||
BOOST_RANGE_RETURNS_TEST2( find_end, v, std::less<int>() );
|
||||
BOOST_RANGE_RETURNS_TEST2( find_first_of, v, std::less<int>() );
|
||||
BOOST_RANGE_RETURNS_TEST2( search, v, std::less<int>() );
|
||||
BOOST_RANGE_RETURNS_TEST2( boost::search, v, std::less<int>() );
|
||||
BOOST_RANGE_RETURNS_TEST2( lower_bound, 0, std::less<int>() );
|
||||
BOOST_RANGE_RETURNS_TEST2( upper_bound, 0, std::less<int>() );
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
# pragma warn -8091 // suppress warning in Boost.Test
|
||||
# pragma warn -8057 // unused argument argc/argv in Boost.Test
|
||||
#endif
|
||||
|
@ -112,6 +112,64 @@ namespace
|
||||
test_remove_erase_if_impl<std::list<int> >();
|
||||
}
|
||||
|
||||
template< class Container >
|
||||
void test_unique_erase_impl()
|
||||
{
|
||||
Container source;
|
||||
source.push_back(1);
|
||||
source.push_back(1);
|
||||
source.push_back(1);
|
||||
source.push_back(2);
|
||||
source.push_back(3);
|
||||
source.push_back(3);
|
||||
|
||||
Container reference;
|
||||
reference.push_back(1);
|
||||
reference.push_back(2);
|
||||
reference.push_back(3);
|
||||
|
||||
boost::unique_erase(source);
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||
source.begin(), source.end() );
|
||||
}
|
||||
|
||||
void test_unique_erase()
|
||||
{
|
||||
test_unique_erase_impl<std::vector<int> >();
|
||||
test_unique_erase_impl<std::list<int> >();
|
||||
}
|
||||
|
||||
struct distance_smaller_2
|
||||
{
|
||||
typedef bool result_type;
|
||||
typedef int argument_type;
|
||||
bool operator()(int x, int y) const { return std::abs(x - y) < 2; }
|
||||
};
|
||||
|
||||
template< class Container >
|
||||
void test_unique_erase_pred_impl()
|
||||
{
|
||||
Container source;
|
||||
for (int i = 0; i < 10; ++i)
|
||||
source.push_back(i);
|
||||
|
||||
Container reference;
|
||||
for (int i = 0; i < 10; i += 2)
|
||||
reference.push_back(i);
|
||||
|
||||
|
||||
boost::unique_erase(source, distance_smaller_2());
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||
source.begin(), source.end() );
|
||||
}
|
||||
|
||||
void test_unique_erase_pred()
|
||||
{
|
||||
test_unique_erase_pred_impl<std::vector<int> >();
|
||||
test_unique_erase_pred_impl<std::list<int> >();
|
||||
}
|
||||
}
|
||||
|
||||
boost::unit_test::test_suite*
|
||||
@ -123,6 +181,8 @@ init_unit_test_suite(int argc, char* argv[])
|
||||
test->add( BOOST_TEST_CASE( &test_erase ) );
|
||||
test->add( BOOST_TEST_CASE( &test_remove_erase ) );
|
||||
test->add( BOOST_TEST_CASE( &test_remove_erase_if ) );
|
||||
test->add( BOOST_TEST_CASE( &test_unique_erase ) );
|
||||
test->add( BOOST_TEST_CASE( &test_unique_erase_pred ) );
|
||||
|
||||
return test;
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/range/algorithm/lower_bound.hpp>
|
||||
#include "../test_driver/range_return_test_driver.hpp"
|
||||
#include <algorithm>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include "../test_driver/range_return_test_driver.hpp"
|
||||
#include <algorithm>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include "../test_driver/range_return_test_driver.hpp"
|
||||
#include <algorithm>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include "../test_driver/range_return_test_driver.hpp"
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <boost/assign.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include "../test_function/counted_function.hpp"
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user