forked from boostorg/range
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:
@ -18,28 +18,34 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
/// \brief template function count_if
|
||||
///
|
||||
/// range-based version of the count_if std algorithm
|
||||
///
|
||||
/// \pre SinglePassRange is a model of the SinglePassRangeConcept
|
||||
/// \pre UnaryPredicate is a model of the UnaryPredicateConcept
|
||||
template< class SinglePassRange, class UnaryPredicate >
|
||||
inline BOOST_DEDUCED_TYPENAME boost::range_difference<SinglePassRange>::type
|
||||
count_if(SinglePassRange& rng, UnaryPredicate pred)
|
||||
namespace range
|
||||
{
|
||||
boost::function_requires< SinglePassRangeConcept<SinglePassRange> >();
|
||||
return std::count_if(boost::begin(rng), boost::end(rng), pred);
|
||||
}
|
||||
|
||||
/// \overload
|
||||
template< class SinglePassRange, class UnaryPredicate >
|
||||
inline BOOST_DEDUCED_TYPENAME boost::range_difference<const SinglePassRange>::type
|
||||
count_if(const SinglePassRange& rng, UnaryPredicate pred)
|
||||
{
|
||||
boost::function_requires< SinglePassRangeConcept<SinglePassRange> >();
|
||||
return std::count_if(boost::begin(rng), boost::end(rng), pred);
|
||||
}
|
||||
/// \brief template function count_if
|
||||
///
|
||||
/// range-based version of the count_if std algorithm
|
||||
///
|
||||
/// \pre SinglePassRange is a model of the SinglePassRangeConcept
|
||||
/// \pre UnaryPredicate is a model of the UnaryPredicateConcept
|
||||
template< class SinglePassRange, class UnaryPredicate >
|
||||
inline BOOST_DEDUCED_TYPENAME boost::range_difference<SinglePassRange>::type
|
||||
count_if(SinglePassRange& rng, UnaryPredicate pred)
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange> ));
|
||||
return std::count_if(boost::begin(rng), boost::end(rng), pred);
|
||||
}
|
||||
|
||||
/// \overload
|
||||
template< class SinglePassRange, class UnaryPredicate >
|
||||
inline BOOST_DEDUCED_TYPENAME boost::range_difference<const SinglePassRange>::type
|
||||
count_if(const SinglePassRange& rng, UnaryPredicate pred)
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
|
||||
return std::count_if(boost::begin(rng), boost::end(rng), pred);
|
||||
}
|
||||
|
||||
} // namespace range
|
||||
using range::count_if;
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
|
Reference in New Issue
Block a user