forked from boostorg/range
Compare commits
38 Commits
revert-45-
...
boost-1.73
Author | SHA1 | Date | |
---|---|---|---|
77a4dd5124 | |||
4ec46acdf5 | |||
cecebeea51 | |||
802fda6701 | |||
4ad147a220 | |||
eced0cfac8 | |||
9f94c8703b | |||
023f45be01 | |||
364f755d99 | |||
af9f65e06e | |||
b91cb90dca | |||
7efe3c68f6 | |||
357bf3b980 | |||
9192996a93 | |||
4cfd4d8287 | |||
70d1727ed3 | |||
406226eccd | |||
05532829bd | |||
c24661a636 | |||
314b5d6b3c | |||
4dd5ad0f64 | |||
f1906e914e | |||
795046f8fc | |||
2aaa802e6a | |||
5b2500872d | |||
b1d5d23514 | |||
aaebfa5b20 | |||
95a62a3b3a | |||
67929cd7df | |||
5408f220dd | |||
937a411c3f | |||
1dac6a796e | |||
1234c59a39 | |||
e0d2e492a1 | |||
619c074146 | |||
efdd98332b | |||
97951d2a8b | |||
efa2dc71f9 |
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
|
@ -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]
|
||||
|
@ -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;
|
||||
|
@ -15,7 +15,7 @@
|
||||
#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)
|
||||
@ -32,7 +32,7 @@ namespace boost
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
range_reference<SinglePassRange>::type argument_type;
|
||||
|
||||
using result_type = decltype(std::declval<argument_type>().get() );
|
||||
typedef decltype( boost::declval<argument_type>().get() ) result_type;
|
||||
|
||||
result_type operator()( argument_type &&r ) const
|
||||
{
|
||||
@ -46,11 +46,11 @@ namespace boost
|
||||
: public transformed_range<unwrap_ref<SinglePassRange>,
|
||||
SinglePassRange>
|
||||
{
|
||||
using base = transformed_range<unwrap_ref<SinglePassRange>,
|
||||
SinglePassRange>;
|
||||
typedef transformed_range<unwrap_ref<SinglePassRange>,
|
||||
SinglePassRange> base;
|
||||
public:
|
||||
using transform_fn_type = unwrap_ref<SinglePassRange>;
|
||||
using source_range_type = SinglePassRange;
|
||||
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)
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -3,17 +3,18 @@
|
||||
// 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/
|
||||
//
|
||||
#ifndef BOOST_RANGE_ALGORITHM_MAX_ELEMENT_HPP_INCLUDED
|
||||
#define BOOST_RANGE_ALGORITHM_MAX_ELEMENT_HPP_INCLUDED
|
||||
|
||||
#include <boost/algorithm/minmax_element.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
#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>
|
||||
|
||||
namespace boost
|
||||
@ -21,6 +22,27 @@ 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 boost::first_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 boost::first_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 boost::first_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 boost::first_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(
|
||||
boost::first_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(
|
||||
boost::first_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(
|
||||
boost::first_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(
|
||||
boost::first_max_element(boost::begin(rng), boost::end(rng), pred),
|
||||
detail::max_element(boost::begin(rng), boost::end(rng), pred),
|
||||
rng);
|
||||
}
|
||||
|
||||
|
@ -3,17 +3,18 @@
|
||||
// 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/
|
||||
//
|
||||
#ifndef BOOST_RANGE_ALGORITHM_MIN_ELEMENT_HPP_INCLUDED
|
||||
#define BOOST_RANGE_ALGORITHM_MIN_ELEMENT_HPP_INCLUDED
|
||||
|
||||
#include <boost/algorithm/minmax_element.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
#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>
|
||||
|
||||
namespace boost
|
||||
@ -21,6 +22,27 @@ 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 boost::first_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 boost::first_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 boost::first_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 boost::first_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(
|
||||
boost::first_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(
|
||||
boost::first_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(
|
||||
boost::first_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(
|
||||
boost::first_min_element(boost::begin(rng), boost::end(rng), pred),
|
||||
detail::min_element(boost::begin(rng), boost::end(rng), pred),
|
||||
rng);
|
||||
}
|
||||
|
||||
|
@ -32,12 +32,12 @@ struct wrap_rand
|
||||
{
|
||||
typedef unsigned int result_type;
|
||||
|
||||
static result_type (min)()
|
||||
static BOOST_CONSTEXPR result_type (min)()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static result_type (max)()
|
||||
static BOOST_CONSTEXPR result_type (max)()
|
||||
{
|
||||
return RAND_MAX;
|
||||
}
|
||||
@ -64,12 +64,12 @@ struct wrap_generator
|
||||
|
||||
wrap_generator(Generator& gen) : g(gen) {}
|
||||
|
||||
static result_type (min)()
|
||||
static BOOST_CONSTEXPR result_type (min)()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static result_type (max)()
|
||||
static BOOST_CONSTEXPR result_type (max)()
|
||||
{
|
||||
return max_arg - 1;
|
||||
}
|
||||
|
@ -20,37 +20,9 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
||||
namespace range_detail
|
||||
namespace range
|
||||
{
|
||||
|
||||
template < class Container, class Range >
|
||||
inline Container& push_back_impl( Container& on, Range&& from, std::false_type)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<Range> ));
|
||||
BOOST_ASSERT_MSG(!range_detail::is_same_object(on, from),
|
||||
"cannot move from a container to itself");
|
||||
on.insert( on.end(),
|
||||
std::make_move_iterator(boost::begin(from)),
|
||||
std::make_move_iterator(boost::end(from)));
|
||||
return on;
|
||||
}
|
||||
|
||||
template < class Container, class Range >
|
||||
inline Container& push_back_impl( Container& on, const Range& from, std::true_type)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const Range> ));
|
||||
BOOST_ASSERT_MSG(!range_detail::is_same_object(on, from),
|
||||
"cannot copy from a container to itself");
|
||||
on.insert( on.end(), boost::begin(from), boost::end(from));
|
||||
return on;
|
||||
}
|
||||
|
||||
} //namespace range_detail
|
||||
#endif
|
||||
|
||||
namespace range {
|
||||
#if defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
||||
template< class Container, class Range >
|
||||
inline Container& push_back( Container& on, const Range& from )
|
||||
{
|
||||
@ -62,19 +34,6 @@ inline Container& push_back( Container& on, const Range& from )
|
||||
return on;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template< class Container, class Range >
|
||||
inline Container& push_back( Container& on, Range&& from )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<Container> ));
|
||||
range_detail::push_back_impl(on,
|
||||
std::forward<Range>(from),
|
||||
std::is_lvalue_reference<Range>() );
|
||||
return on;
|
||||
}
|
||||
|
||||
#endif
|
||||
} // namespace range
|
||||
using range::push_back;
|
||||
} // namespace boost
|
||||
|
@ -22,6 +22,8 @@
|
||||
#else
|
||||
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/workaround.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -94,7 +96,10 @@ namespace range_adl_barrier
|
||||
{
|
||||
|
||||
template< class T >
|
||||
BOOST_CONSTEXPR inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type begin( T& r )
|
||||
#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))
|
||||
using namespace range_detail;
|
||||
@ -103,7 +108,10 @@ BOOST_CONSTEXPR inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type begin( T&
|
||||
}
|
||||
|
||||
template< class T >
|
||||
BOOST_CONSTEXPR inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type begin( const T& r )
|
||||
#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))
|
||||
using namespace range_detail;
|
||||
|
@ -252,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
|
||||
|
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
|
||||
{
|
||||
|
@ -23,13 +23,18 @@
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template< class T >
|
||||
inline BOOST_CXX14_CONSTEXPR BOOST_DEDUCED_TYPENAME range_difference<T>::type
|
||||
distance( const T& r )
|
||||
namespace range_distance_adl_barrier
|
||||
{
|
||||
return boost::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
|
||||
|
@ -24,6 +24,8 @@
|
||||
#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
|
||||
{
|
||||
@ -88,7 +90,10 @@ namespace range_adl_barrier
|
||||
{
|
||||
|
||||
template< class T >
|
||||
BOOST_CONSTEXPR inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type end( T& r )
|
||||
#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))
|
||||
using namespace range_detail;
|
||||
@ -97,7 +102,10 @@ BOOST_CONSTEXPR inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type end( T& r
|
||||
}
|
||||
|
||||
template< class T >
|
||||
BOOST_CONSTEXPR inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type end( const T& r )
|
||||
#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))
|
||||
using namespace range_detail;
|
||||
|
@ -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>
|
||||
|
@ -221,3 +221,5 @@ test-suite range :
|
||||
[ range-test value_type ]
|
||||
;
|
||||
|
||||
# `quick` target (for CI)
|
||||
alias quick : std_container ;
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && !defined(BOOST_NO_CXX11_RANGE_BASED_FOR)
|
||||
#if !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && !defined(BOOST_NO_CXX11_RANGE_BASED_FOR) && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
template< class Container >
|
||||
@ -59,76 +58,6 @@ namespace
|
||||
test_push_back_impl< std::vector<std::size_t> >();
|
||||
test_push_back_impl< std::list<std::size_t> >();
|
||||
}
|
||||
|
||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
||||
// test type which is not copyable by moveable.
|
||||
class noncopyable_int : boost::noncopyable {
|
||||
private:
|
||||
int i;
|
||||
public:
|
||||
noncopyable_int(int x) : i(x) {}
|
||||
noncopyable_int(const noncopyable_int&) = delete;
|
||||
noncopyable_int& operator=(const noncopyable_int&) = delete;
|
||||
noncopyable_int(noncopyable_int&& o) : i(o.i) {}
|
||||
noncopyable_int& operator=(noncopyable_int&& o) { return o; }
|
||||
bool operator!=(const noncopyable_int &rhs) { return i != rhs.i; }
|
||||
friend std::ostream &operator<<(std::ostream &os, const noncopyable_int& x);
|
||||
};
|
||||
|
||||
std::ostream & operator<<(std::ostream &os, const noncopyable_int& x)
|
||||
{
|
||||
return os << x.i;
|
||||
}
|
||||
|
||||
template< class Container >
|
||||
void test_push_back_move_impl(std::size_t n)
|
||||
{
|
||||
Container test;
|
||||
Container reference;
|
||||
for (std::size_t i = 0; i < n; ++i)
|
||||
reference.push_back(noncopyable_int(i));
|
||||
|
||||
{
|
||||
Container to_push_back;
|
||||
for (std::size_t i = 0; i < n; ++i)
|
||||
to_push_back.push_back(noncopyable_int(i));
|
||||
|
||||
boost::push_back(test, std::move(to_push_back));
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||
test.begin(), test.end() );
|
||||
}
|
||||
// Do it again to push onto non-empty container
|
||||
for (std::size_t i = 0; i < n; ++i)
|
||||
reference.push_back(noncopyable_int(i));
|
||||
|
||||
{
|
||||
Container to_push_back;
|
||||
for (std::size_t i = 0; i < n; ++i)
|
||||
to_push_back.push_back(noncopyable_int(i));
|
||||
|
||||
boost::push_back(test, std::move(to_push_back));
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS( reference.begin(), reference.end(),
|
||||
test.begin(), test.end() );
|
||||
}
|
||||
}
|
||||
|
||||
template< class Container >
|
||||
void test_push_back_move_impl()
|
||||
{
|
||||
test_push_back_move_impl< Container >(0);
|
||||
test_push_back_move_impl< Container >(1);
|
||||
test_push_back_move_impl< Container >(2);
|
||||
test_push_back_move_impl< Container >(100);
|
||||
}
|
||||
|
||||
void test_push_back_move()
|
||||
{
|
||||
test_push_back_move_impl< std::vector<noncopyable_int> >();
|
||||
test_push_back_move_impl< std::list<noncopyable_int> >();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
boost::unit_test::test_suite*
|
||||
@ -138,9 +67,6 @@ init_unit_test_suite(int argc, char* argv[])
|
||||
= BOOST_TEST_SUITE( "RangeTestSuite.algorithm_ext.push_back" );
|
||||
|
||||
test->add( BOOST_TEST_CASE( &test_push_back ) );
|
||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
||||
test->add( BOOST_TEST_CASE( &test_push_back_move ) );
|
||||
#endif
|
||||
|
||||
return test;
|
||||
}
|
||||
|
Reference in New Issue
Block a user