forked from boostorg/range
[boost][range] - Improved handling of temporary ranges in range algorithms.
[SVN r63902]
This commit is contained in:
@ -34,6 +34,19 @@ inline ForwardRange& iota( ForwardRange& rng, Value x )
|
||||
return rng;
|
||||
}
|
||||
|
||||
template< class ForwardRange, class Value >
|
||||
inline const ForwardRange& iota( const ForwardRange& rng, Value x )
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type iterator_t;
|
||||
|
||||
iterator_t last_target = ::boost::end(rng);
|
||||
for (iterator_t target = ::boost::begin(rng); target != last_target; ++target, ++x)
|
||||
*target = x;
|
||||
|
||||
return rng;
|
||||
}
|
||||
|
||||
} // namespace range
|
||||
using range::iota;
|
||||
} // namespace boost
|
||||
|
Reference in New Issue
Block a user