forked from boostorg/range
Compare commits
44 Commits
fix-boost-
...
revert-45-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4614777aaf | ||
|
|
83a352fa58 | ||
|
|
0e0d77cfab | ||
|
|
d1f36fba8d | ||
|
|
4283443532 | ||
|
|
3771624560 | ||
|
|
4a729678fd | ||
|
|
dfa3697764 | ||
|
|
8b98b696ff | ||
|
|
d99628981d | ||
|
|
e65434eb4f | ||
|
|
93513a3801 | ||
|
|
93eb91e63e | ||
|
|
f3a4246bd9 | ||
|
|
796080bbb8 | ||
|
|
370f1a4cd2 | ||
|
|
7d564572e2 | ||
|
|
9afc3bcbe2 | ||
|
|
69409ed63a | ||
|
|
23e5801e2a | ||
|
|
e476e1900a | ||
|
|
452b1bb7e7 | ||
|
|
7b89c747d6 | ||
|
|
deb3ae9800 | ||
|
|
56d470635d | ||
|
|
5c70a54597 | ||
|
|
f829c55c72 | ||
|
|
910fc7bf82 | ||
|
|
67c18ac1f1 | ||
|
|
5787c56994 | ||
|
|
1b4f8100ef | ||
|
|
7567dce0c1 | ||
|
|
283b8beddc | ||
|
|
4ce15f9b52 | ||
|
|
bb43887430 | ||
|
|
0e931f4a80 | ||
|
|
4f66482414 | ||
|
|
7669f52547 | ||
|
|
2356783e17 | ||
|
|
9b3a21b5e3 | ||
|
|
1965b797d8 | ||
|
|
b0b08e0039 | ||
|
|
c865de5aa6 | ||
|
|
af2f17ccc5 |
@@ -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
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -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>));
|
||||
|
||||
@@ -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 result_type (min)()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static 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 result_type (min)()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,37 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range
|
||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
||||
namespace range_detail
|
||||
{
|
||||
|
||||
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 )
|
||||
{
|
||||
@@ -34,6 +62,19 @@ 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
|
||||
|
||||
@@ -36,7 +36,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 +52,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,13 +71,13 @@ 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;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ namespace range_adl_barrier
|
||||
{
|
||||
|
||||
template< class T >
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type begin( T& r )
|
||||
BOOST_CONSTEXPR 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 +103,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type begin( T& r )
|
||||
}
|
||||
|
||||
template< class T >
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type begin( const T& r )
|
||||
BOOST_CONSTEXPR 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;
|
||||
|
||||
@@ -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
|
||||
>
|
||||
{
|
||||
|
||||
@@ -247,9 +247,8 @@ namespace boost
|
||||
any_iterator_type stored_iterator;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} //namespace detail
|
||||
} //namespace iterators
|
||||
|
||||
namespace range_detail
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace boost
|
||||
struct range_begin<std_container_>
|
||||
{
|
||||
template< typename C >
|
||||
static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type fun( C& c )
|
||||
BOOST_CONSTEXPR static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type fun( C& c )
|
||||
{
|
||||
return c.begin();
|
||||
};
|
||||
@@ -46,7 +46,7 @@ namespace boost
|
||||
struct range_begin<std_pair_>
|
||||
{
|
||||
template< typename P >
|
||||
static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<P>::type fun( const P& p )
|
||||
BOOST_CONSTEXPR static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<P>::type fun( const P& p )
|
||||
{
|
||||
return p.first;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ namespace boost
|
||||
struct range_begin<array_>
|
||||
{
|
||||
template<typename T>
|
||||
static BOOST_RANGE_DEDUCED_TYPENAME range_value<T>::type* fun(T& t)
|
||||
BOOST_CONSTEXPR static BOOST_RANGE_DEDUCED_TYPENAME range_value<T>::type* fun(T& t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ namespace boost
|
||||
namespace range_adl_barrier
|
||||
{
|
||||
template< typename C >
|
||||
inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
|
||||
BOOST_CONSTEXPR 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 );
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace boost
|
||||
struct range_end<std_container_>
|
||||
{
|
||||
template< typename C >
|
||||
static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
|
||||
BOOST_CONSTEXPR static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
|
||||
fun( C& c )
|
||||
{
|
||||
return c.end();
|
||||
@@ -48,7 +48,7 @@ namespace boost
|
||||
struct range_end<std_pair_>
|
||||
{
|
||||
template< typename P >
|
||||
static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<P>::type
|
||||
BOOST_CONSTEXPR static BOOST_RANGE_DEDUCED_TYPENAME range_iterator<P>::type
|
||||
fun( const P& p )
|
||||
{
|
||||
return p.second;
|
||||
@@ -63,7 +63,7 @@ namespace boost
|
||||
struct range_end<array_>
|
||||
{
|
||||
template<typename T>
|
||||
static BOOST_RANGE_DEDUCED_TYPENAME remove_extent<T>::type* fun(T& t)
|
||||
BOOST_CONSTEXPR static BOOST_RANGE_DEDUCED_TYPENAME remove_extent<T>::type* fun(T& t)
|
||||
{
|
||||
return t + remove_extent<T>::size;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ namespace boost
|
||||
namespace range_adl_barrier
|
||||
{
|
||||
template< typename C >
|
||||
inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator<C>::type
|
||||
BOOST_CONSTEXPR 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 );
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -15,18 +15,19 @@
|
||||
# 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
|
||||
inline BOOST_CXX14_CONSTEXPR BOOST_DEDUCED_TYPENAME range_difference<T>::type
|
||||
distance( const T& r )
|
||||
{
|
||||
return std::distance( boost::begin( r ), boost::end( r ) );
|
||||
return boost::distance( boost::begin( r ), boost::end( r ) );
|
||||
}
|
||||
|
||||
} // namespace 'boost'
|
||||
|
||||
@@ -37,7 +37,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 +53,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,13 +69,13 @@ 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 );
|
||||
}
|
||||
@@ -88,7 +88,7 @@ namespace range_adl_barrier
|
||||
{
|
||||
|
||||
template< class T >
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type end( T& r )
|
||||
BOOST_CONSTEXPR 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 +97,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<T>::type end( T& r )
|
||||
}
|
||||
|
||||
template< class T >
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type end( const T& r )
|
||||
BOOST_CONSTEXPR 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;
|
||||
@@ -115,7 +115,7 @@ 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 );
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -51,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 )
|
||||
{
|
||||
@@ -86,32 +103,53 @@ 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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -457,7 +457,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>() );
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
template< class Container >
|
||||
@@ -58,6 +59,76 @@ 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*
|
||||
@@ -67,6 +138,9 @@ 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;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,23 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
// Test an integer range with a step size of 1.
|
||||
template<typename Integer>
|
||||
void test_irange_impl(Integer last)
|
||||
{
|
||||
std::vector<Integer> reference;
|
||||
for (Integer i = static_cast<Integer>(0); i < last; ++i)
|
||||
{
|
||||
reference.push_back(i);
|
||||
}
|
||||
|
||||
std::vector<Integer> test;
|
||||
boost::push_back(test, boost::irange(last));
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS( test.begin(), test.end(),
|
||||
reference.begin(), reference.end() );
|
||||
}
|
||||
|
||||
// Test an integer range with a step size of 1.
|
||||
template<typename Integer>
|
||||
void test_irange_impl(Integer first, Integer last)
|
||||
@@ -34,36 +51,52 @@ namespace boost
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS( test.begin(), test.end(),
|
||||
reference.begin(), reference.end() );
|
||||
}
|
||||
|
||||
|
||||
// Test an integer range with a runtime specified step size.
|
||||
template<typename Integer, typename IntegerInput>
|
||||
void test_irange_impl(IntegerInput first, IntegerInput last, int step)
|
||||
{
|
||||
BOOST_ASSERT( step != 0 );
|
||||
|
||||
|
||||
// Skip tests that have negative values if the type is
|
||||
// unsigned
|
||||
if ((static_cast<IntegerInput>(static_cast<Integer>(first)) != first)
|
||||
|| (static_cast<IntegerInput>(static_cast<Integer>(last)) != last))
|
||||
return;
|
||||
|
||||
|
||||
std::vector<Integer> reference;
|
||||
|
||||
const std::ptrdiff_t first_p = static_cast<std::ptrdiff_t>(first);
|
||||
const std::ptrdiff_t last_p = static_cast<std::ptrdiff_t>(last);
|
||||
const std::ptrdiff_t step_p = static_cast<std::ptrdiff_t>(step);
|
||||
for (std::ptrdiff_t current_value = first_p;
|
||||
for (std::ptrdiff_t current_value = first_p;
|
||||
step_p >= 0 ? current_value < last_p : current_value > last_p;
|
||||
current_value += step_p)
|
||||
reference.push_back(current_value);
|
||||
|
||||
std::vector<Integer> test;
|
||||
boost::push_back(test, boost::irange(first, last, step));
|
||||
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS( test.begin(), test.end(),
|
||||
reference.begin(), reference.end() );
|
||||
}
|
||||
|
||||
// Test driver function that for an integer range [first, last)
|
||||
// drives the test implementation through various integer
|
||||
// types.
|
||||
void test_irange(int last)
|
||||
{
|
||||
test_irange_impl<signed char>(last);
|
||||
test_irange_impl<unsigned char>(last);
|
||||
test_irange_impl<signed short>(last);
|
||||
test_irange_impl<unsigned short>(last);
|
||||
test_irange_impl<signed int>(last);
|
||||
test_irange_impl<unsigned int>(last);
|
||||
test_irange_impl<signed long>(last);
|
||||
test_irange_impl<unsigned long>(last);
|
||||
}
|
||||
|
||||
|
||||
// Test driver function that for an integer range [first, last)
|
||||
// drives the test implementation through various integer
|
||||
// types.
|
||||
@@ -102,6 +135,11 @@ namespace boost
|
||||
// number of implementation branches.
|
||||
void irange_unit_test()
|
||||
{
|
||||
// Test the single-step version of irange(last)
|
||||
test_irange(0);
|
||||
test_irange(1);
|
||||
test_irange(10);
|
||||
|
||||
// Test the single-step version of irange(first, last)
|
||||
test_irange(0, 0);
|
||||
test_irange(0, 1);
|
||||
@@ -124,14 +162,14 @@ namespace boost
|
||||
test_irange(9, -9, -2);
|
||||
test_irange(10, 20, 5);
|
||||
test_irange(20, 10, -5);
|
||||
|
||||
|
||||
test_irange(0, 0, 3);
|
||||
test_irange(0, 1, 3);
|
||||
test_irange(0, 2, 3);
|
||||
test_irange(0, 3, 3);
|
||||
test_irange(0, 4, 3);
|
||||
test_irange(0, 10, 3);
|
||||
|
||||
|
||||
test_irange(0, 0, -3);
|
||||
test_irange(0, -1, -3);
|
||||
test_irange(0, -2, -3);
|
||||
|
||||
@@ -59,8 +59,8 @@ void check_iterator_range()
|
||||
BOOST_CHECK( false );
|
||||
//#endif
|
||||
|
||||
BOOST_CHECK_EQUAL( r.size(), size( r ) );
|
||||
BOOST_CHECK_EQUAL( r2.size(), size( r2 ) );
|
||||
BOOST_CHECK_EQUAL( r.size(), boost::size( r ) );
|
||||
BOOST_CHECK_EQUAL( r2.size(), boost::size( r2 ) );
|
||||
|
||||
BOOST_CHECK_EQUAL( std::distance( r.begin(), r.end() ),
|
||||
std::distance( boost::begin( r2 ), boost::end( r2 ) ) );
|
||||
@@ -280,23 +280,6 @@ void test_sfinae()
|
||||
boost::iterator_range<ptr_iterator> r(ptr_iterator(0), ptr_iterator(0));
|
||||
}
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "Range Test Suite" );
|
||||
|
||||
test->add(BOOST_TEST_CASE(&check_iterator_range));
|
||||
test->add(BOOST_TEST_CASE(&check_iterator_range_operator<iterator_range_test_detail::less>));
|
||||
test->add(BOOST_TEST_CASE(&check_iterator_range_operator<iterator_range_test_detail::less_or_equal>));
|
||||
test->add(BOOST_TEST_CASE(&check_iterator_range_operator<iterator_range_test_detail::greater>));
|
||||
test->add(BOOST_TEST_CASE(&check_iterator_range_operator<iterator_range_test_detail::greater_or_equal>));
|
||||
test->add(BOOST_TEST_CASE(&check_iterator_range_operator<iterator_range_test_detail::equal_to>));
|
||||
test->add(BOOST_TEST_CASE(&check_iterator_range_operator<iterator_range_test_detail::not_equal_to>));
|
||||
test->add(BOOST_TEST_CASE(&iterator_range_test_detail::check_make_iterator_range_n));
|
||||
test->add(BOOST_TEST_CASE(&test_advance));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// Check that constness is propagated correct from
|
||||
@@ -327,3 +310,21 @@ void check_reference_type()
|
||||
test_iter_range<veci_type>(a_vec);
|
||||
test_iter_range<veci_type const>(a_vec);
|
||||
}
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] )
|
||||
{
|
||||
boost::unit_test::test_suite* test = BOOST_TEST_SUITE( "Range Test Suite" );
|
||||
|
||||
test->add(BOOST_TEST_CASE(&check_iterator_range));
|
||||
test->add(BOOST_TEST_CASE(&check_iterator_range_operator<iterator_range_test_detail::less>));
|
||||
test->add(BOOST_TEST_CASE(&check_iterator_range_operator<iterator_range_test_detail::less_or_equal>));
|
||||
test->add(BOOST_TEST_CASE(&check_iterator_range_operator<iterator_range_test_detail::greater>));
|
||||
test->add(BOOST_TEST_CASE(&check_iterator_range_operator<iterator_range_test_detail::greater_or_equal>));
|
||||
test->add(BOOST_TEST_CASE(&check_iterator_range_operator<iterator_range_test_detail::equal_to>));
|
||||
test->add(BOOST_TEST_CASE(&check_iterator_range_operator<iterator_range_test_detail::not_equal_to>));
|
||||
test->add(BOOST_TEST_CASE(&iterator_range_test_detail::check_make_iterator_range_n));
|
||||
test->add(BOOST_TEST_CASE(&test_advance));
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
namespace boost
|
||||
@@ -22,9 +21,12 @@ namespace boost
|
||||
namespace
|
||||
{
|
||||
class TestTicket5486Pred
|
||||
: public std::binary_function<int,int,bool>
|
||||
{
|
||||
public:
|
||||
typedef int first_argument_type;
|
||||
typedef int second_argument_type;
|
||||
typedef bool result_type;
|
||||
|
||||
explicit TestTicket5486Pred(int x) {}
|
||||
bool operator()(int,int) const { return true; }
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user