[boost][range] - Improved handling of temporary ranges in range algorithms.

[SVN r63902]
This commit is contained in:
Neil Groves
2010-07-12 00:08:41 +00:00
parent db345d4e8e
commit ef000176d8
36 changed files with 649 additions and 27 deletions

View File

@ -34,6 +34,15 @@ inline RandomAccessRange& random_shuffle(RandomAccessRange& rng)
return rng;
}
/// \overload
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));
return rng;
}
/// \overload
template<class RandomAccessRange, class Generator>
inline RandomAccessRange& random_shuffle(RandomAccessRange& rng, Generator& gen)
@ -43,6 +52,15 @@ inline RandomAccessRange& random_shuffle(RandomAccessRange& rng, Generator& gen)
return rng;
}
/// \overload
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);
return rng;
}
} // namespace range
using range::random_shuffle;
} // namespace boost