Boost.Range fixes for Tickets: 4131, 4136, 4398, 4388. Plus updated history in the documentation.

[SVN r64111]
This commit is contained in:
Neil Groves
2010-07-17 19:44:31 +00:00
parent a06f11589f
commit 22c4ab4a06
97 changed files with 575 additions and 526 deletions

View File

@ -7,13 +7,13 @@
// 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)
//
//
// Copyright 2006 Thorsten Ottosen.
// 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)
//
//
// Copyright 2004 Eric Niebler.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@ -31,6 +31,7 @@
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/distance.hpp>
#include <numeric>
@ -39,14 +40,14 @@ namespace boost
template< class SinglePassRange, class Value >
inline Value accumulate( const SinglePassRange& rng, Value init )
{
boost::function_requires< SinglePassRangeConcept<SinglePassRange> >();
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange> ));
return std::accumulate( boost::begin(rng), boost::end(rng), init );
}
template< class SinglePassRange, class Value, class BinaryOperation >
inline Value accumulate( const SinglePassRange& rng, Value init, BinaryOperation op )
{
boost::function_requires< SinglePassRangeConcept<SinglePassRange> >();
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
return std::accumulate( boost::begin(rng), boost::end(rng), init, op );
}
@ -54,42 +55,42 @@ namespace boost
template< class SinglePassRange1, class SinglePassRange2, class Value >
inline Value inner_product( const SinglePassRange1& rng1, const SinglePassRange2& rng2, Value init )
{
boost::function_requires< SinglePassRangeConcept<SinglePassRange1> >();
boost::function_requires< SinglePassRangeConcept<SinglePassRange2> >();
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
BOOST_ASSERT( boost::distance(rng2) >= boost::distance(rng1) );
return std::inner_product( boost::begin(rng1), boost::end(rng1),
boost::begin(rng2), init );
return std::inner_product( boost::begin(rng1), boost::end(rng1),
boost::begin(rng2), init );
}
template< class SinglePassRange1,
class SinglePassRange2,
class Value,
class Value,
class BinaryOperation1, class BinaryOperation2 >
inline Value inner_product( const SinglePassRange1& rng1, const SinglePassRange2& rng2,
Value init,
Value init,
BinaryOperation1 op1, BinaryOperation2 op2 )
{
boost::function_requires< SinglePassRangeConcept<SinglePassRange1> >();
boost::function_requires< SinglePassRangeConcept<SinglePassRange2> >();
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
BOOST_ASSERT( boost::distance(rng2) >= boost::distance(rng1) );
return std::inner_product( boost::begin(rng1), boost::end(rng1),
boost::begin(rng2), init, op1, op2 );
return std::inner_product( boost::begin(rng1), boost::end(rng1),
boost::begin(rng2), init, op1, op2 );
}
template< class SinglePassRange, class OutputIterator >
inline OutputIterator partial_sum ( const SinglePassRange& rng,
inline OutputIterator partial_sum ( const SinglePassRange& rng,
OutputIterator result )
{
boost::function_requires< SinglePassRangeConcept<SinglePassRange> >();
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
return std::partial_sum( boost::begin(rng), boost::end(rng), result );
}
template< class SinglePassRange, class OutputIterator, class BinaryOperation >
inline OutputIterator partial_sum ( const SinglePassRange& rng, OutputIterator result,
inline OutputIterator partial_sum ( const SinglePassRange& rng, OutputIterator result,
BinaryOperation op )
{
boost::function_requires< SinglePassRangeConcept<SinglePassRange> >();
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
return std::partial_sum( boost::begin(rng), boost::end(rng), result, op );
}
@ -97,8 +98,8 @@ namespace boost
inline OutputIterator adjacent_difference ( const SinglePassRange& rng,
OutputIterator result )
{
boost::function_requires< SinglePassRangeConcept<SinglePassRange> >();
return std::adjacent_difference( boost::begin(rng), boost::end(rng),
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
return std::adjacent_difference( boost::begin(rng), boost::end(rng),
result );
}
@ -107,11 +108,11 @@ namespace boost
OutputIterator result,
BinaryOperation op )
{
boost::function_requires< SinglePassRangeConcept<SinglePassRange> >();
return std::adjacent_difference( boost::begin(rng), boost::end(rng),
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange> ));
return std::adjacent_difference( boost::begin(rng), boost::end(rng),
result, op );
}
}
#endif