forked from boostorg/range
Compare commits
19 Commits
revert-45-
...
feature/fi
Author | SHA1 | Date | |
---|---|---|---|
b91cb90dca | |||
7efe3c68f6 | |||
357bf3b980 | |||
9192996a93 | |||
70d1727ed3 | |||
406226eccd | |||
05532829bd | |||
c24661a636 | |||
4dd5ad0f64 | |||
f1906e914e | |||
795046f8fc | |||
2aaa802e6a | |||
5b2500872d | |||
5408f220dd | |||
937a411c3f | |||
1dac6a796e | |||
1234c59a39 | |||
e0d2e492a1 | |||
619c074146 |
131
.travis.yml
Normal file
131
.travis.yml
Normal 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
|
@ -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(std::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
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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