forked from boostorg/range
Boost.Range fixes for Tickets: 4131, 4136, 4398, 4388. Plus updated history in the documentation.
[SVN r64111]
This commit is contained in:
4
include/boost/range.hpp
Executable file → Normal file
4
include/boost/range.hpp
Executable file → Normal file
@ -15,7 +15,7 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#if _MSC_VER == 1300 // experiment
|
||||
#if defined(_MSC_VER) && (_MSC_VER == 1300)
|
||||
|
||||
#include <boost/range/detail/collection_traits.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
@ -28,6 +28,6 @@
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/sub_range.hpp>
|
||||
|
||||
#endif // _MSC_VER == 1300 // experiment
|
||||
#endif // _MSC_VER == 1300
|
||||
|
||||
#endif
|
||||
|
@ -25,9 +25,9 @@ namespace boost
|
||||
template< class Map >
|
||||
struct select_first
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t;
|
||||
typedef const BOOST_DEDUCED_TYPENAME pair_t::first_type&
|
||||
result_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME range_value<Map>::type pair_t;
|
||||
typedef const BOOST_DEDUCED_TYPENAME pair_t::first_type&
|
||||
result_type;
|
||||
|
||||
result_type operator()( const pair_t& r ) const
|
||||
{
|
||||
@ -38,8 +38,8 @@ namespace boost
|
||||
template< class Map >
|
||||
struct select_second_mutable
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME pair_t::second_type& result_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME range_value<Map>::type pair_t;
|
||||
typedef BOOST_DEDUCED_TYPENAME pair_t::second_type& result_type;
|
||||
|
||||
result_type operator()( pair_t& r ) const
|
||||
{
|
||||
@ -50,16 +50,16 @@ namespace boost
|
||||
template< class Map >
|
||||
struct select_second_const
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME Map::value_type pair_t;
|
||||
typedef const BOOST_DEDUCED_TYPENAME pair_t::second_type&
|
||||
result_type;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME range_value<Map>::type pair_t;
|
||||
typedef const BOOST_DEDUCED_TYPENAME pair_t::second_type&
|
||||
result_type;
|
||||
|
||||
result_type operator()( const pair_t& r ) const
|
||||
{
|
||||
return r.second;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<class StdPairRng>
|
||||
class select_first_range
|
||||
: public transform_range<
|
||||
@ -78,7 +78,7 @@ namespace boost
|
||||
|
||||
select_first_range(const base& other) : base(other) {}
|
||||
};
|
||||
|
||||
|
||||
template<class StdPairRng>
|
||||
class select_second_mutable_range
|
||||
: public transform_range<
|
||||
@ -97,7 +97,7 @@ namespace boost
|
||||
|
||||
select_second_mutable_range(const base& other) : base(other) {}
|
||||
};
|
||||
|
||||
|
||||
template<class StdPairRng>
|
||||
class select_second_const_range
|
||||
: public transform_range<
|
||||
@ -116,20 +116,20 @@ namespace boost
|
||||
|
||||
select_second_const_range(const base& other) : base(other) {}
|
||||
};
|
||||
|
||||
|
||||
template< class StdPairRng >
|
||||
inline select_first_range<StdPairRng>
|
||||
inline select_first_range<StdPairRng>
|
||||
operator|( const StdPairRng& r, map_keys_forwarder )
|
||||
{
|
||||
return operator|( r,
|
||||
return operator|( r,
|
||||
boost::adaptors::transformed( select_first<StdPairRng>() ) );
|
||||
}
|
||||
|
||||
template< class StdPairRng >
|
||||
inline select_second_mutable_range<StdPairRng>
|
||||
inline select_second_mutable_range<StdPairRng>
|
||||
operator|( StdPairRng& r, map_values_forwarder )
|
||||
{
|
||||
return operator|( r,
|
||||
return operator|( r,
|
||||
boost::adaptors::transformed( select_second_mutable<StdPairRng>() ) );
|
||||
}
|
||||
|
||||
@ -137,27 +137,27 @@ namespace boost
|
||||
inline select_second_const_range<StdPairRng>
|
||||
operator|( const StdPairRng& r, map_values_forwarder )
|
||||
{
|
||||
return operator|( r,
|
||||
boost::adaptors::transformed( select_second_const<StdPairRng>() ) );
|
||||
return operator|( r,
|
||||
boost::adaptors::transformed( select_second_const<StdPairRng>() ) );
|
||||
}
|
||||
|
||||
|
||||
} // 'range_detail'
|
||||
|
||||
|
||||
using range_detail::select_first_range;
|
||||
using range_detail::select_second_mutable_range;
|
||||
using range_detail::select_second_const_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const range_detail::map_keys_forwarder map_keys =
|
||||
const range_detail::map_keys_forwarder map_keys =
|
||||
range_detail::map_keys_forwarder();
|
||||
|
||||
const range_detail::map_values_forwarder map_values =
|
||||
const range_detail::map_values_forwarder map_values =
|
||||
range_detail::map_values_forwarder();
|
||||
}
|
||||
|
||||
|
||||
template<class StdPairRange>
|
||||
inline select_first_range<StdPairRange>
|
||||
keys(const StdPairRange& rng)
|
||||
@ -165,7 +165,7 @@ namespace boost
|
||||
return select_first_range<StdPairRange>(
|
||||
range_detail::select_first<StdPairRange>(), rng );
|
||||
}
|
||||
|
||||
|
||||
template<class StdPairRange>
|
||||
inline select_second_const_range<StdPairRange>
|
||||
values(const StdPairRange& rng)
|
||||
@ -173,7 +173,7 @@ namespace boost
|
||||
return select_second_const_range<StdPairRange>(
|
||||
range_detail::select_second_const<StdPairRange>(), rng );
|
||||
}
|
||||
|
||||
|
||||
template<class StdPairRange>
|
||||
inline select_second_mutable_range<StdPairRange>
|
||||
values(StdPairRange& rng)
|
||||
@ -182,7 +182,7 @@ namespace boost
|
||||
range_detail::select_second_mutable<StdPairRange>(), rng );
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -134,7 +134,11 @@ public:
|
||||
typedef Iterator1 iterator1_t;
|
||||
typedef Iterator2 iterator2_t;
|
||||
|
||||
join_iterator() : m_section(0u) {}
|
||||
join_iterator()
|
||||
: m_section(0u)
|
||||
, m_it(0u, iterator1_t(), iterator2_t())
|
||||
, m_link(link_t(iterator1_t(), iterator2_t()))
|
||||
{}
|
||||
|
||||
join_iterator(unsigned int section, Iterator1 current1, Iterator1 last1, Iterator2 first2, Iterator2 current2)
|
||||
: m_section(section)
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user