Compare commits

...

7 Commits

Author SHA1 Message Date
neilgroves
5b2500872d Revert "push_back: added support for not-copyable but moveable value-types li…" 2018-01-03 14:36:50 +00:00
Peter Dimov
5408f220dd Split Travis jobs to avoid timeout 2017-12-03 03:16:30 +02:00
Peter Dimov
937a411c3f Add .travis.yml 2017-12-02 19:17:02 +02:00
Peter Dimov
1dac6a796e Add quick test target (for CI) 2017-12-02 19:10:56 +02:00
Peter Dimov
1234c59a39 Merge pull request #61 from danieljames/develop
Include boost/next_prior.hpp where needed
2017-12-02 16:00:35 +02:00
Daniel James
e0d2e492a1 Include boost/next_prior.hpp where needed
A recent change to boost/utility.hpp removed the include of this header,
so now it's needed for boost::prior and boost::next.

b74f49f1e5
2017-12-02 10:40:16 +00:00
neilgroves
619c074146 Merge pull request #58 from boostorg/revert-45-develop
Revert "Update irange.hpp"
2017-11-15 23:22:00 +00:00
8 changed files with 138 additions and 116 deletions

131
.travis.yml Normal file
View File

@@ -0,0 +1,131 @@
# 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++-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

View File

@@ -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
{

View File

@@ -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

View File

@@ -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>

View File

@@ -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
{

View File

@@ -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>

View File

@@ -221,3 +221,5 @@ test-suite range :
[ range-test value_type ]
;
# `quick` target (for CI)
alias quick : std_container ;

View File

@@ -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;
}