Boost.Range algorithms are now in the boost::range namespace and brought into boost by the appropriate using statement. This allows better interoperation with Boost.Algorithm since errors only occur when the use calls similarly named ambiguous functions. In this event the user can disambiguate by using algorithm::xxx() or range::xxx(). This iteration also updates the concept assert code in the range algorithms.

[SVN r61023]
This commit is contained in:
Neil Groves
2010-04-03 19:14:13 +00:00
parent b4ae711d4e
commit 22c72c53eb
52 changed files with 2766 additions and 2461 deletions

View File

@ -17,26 +17,32 @@
namespace boost
{
/// \brief template function for_each
///
/// range-based version of the for_each std algorithm
///
/// \pre SinglePassRange is a model of the SinglePassRangeConcept
/// \pre UnaryFunction is a model of the UnaryFunctionConcept
template< class SinglePassRange, class UnaryFunction >
inline UnaryFunction for_each(SinglePassRange & rng, UnaryFunction fun)
namespace range
{
boost::function_requires< SinglePassRangeConcept< SinglePassRange > >();
return std::for_each(boost::begin(rng),boost::end(rng),fun);
}
/// \overload
template< class SinglePassRange, class UnaryFunction >
inline UnaryFunction for_each(SinglePassRange const & rng, UnaryFunction fun)
{
boost::function_requires< SinglePassRangeConcept< SinglePassRange > >();
return std::for_each(boost::begin(rng),boost::end(rng),fun);
}
/// \brief template function for_each
///
/// range-based version of the for_each std algorithm
///
/// \pre SinglePassRange is a model of the SinglePassRangeConcept
/// \pre UnaryFunction is a model of the UnaryFunctionConcept
template< class SinglePassRange, class UnaryFunction >
inline UnaryFunction for_each(SinglePassRange & rng, UnaryFunction fun)
{
BOOST_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange> ));
return std::for_each(boost::begin(rng),boost::end(rng),fun);
}
/// \overload
template< class SinglePassRange, class UnaryFunction >
inline UnaryFunction for_each(SinglePassRange const & rng, UnaryFunction fun)
{
BOOST_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
return std::for_each(boost::begin(rng),boost::end(rng),fun);
}
} // namespace range
using range::for_each;
} // namespace boost
#endif // include guard