Qualify calls to Boost.Algorithm algs that have the same name as ones in the standard; prevents ADL ambiguities. Thanks to Billy O'Neill for the heads up.

This commit is contained in:
Marshall Clow
2018-01-10 10:26:21 -08:00
parent cb52d61054
commit 63c85e7c5e
6 changed files with 16 additions and 15 deletions

View File

@ -34,14 +34,14 @@ template<class InputIterator, class T>
T reduce(InputIterator first, InputIterator last, T init)
{
typedef typename std::iterator_traits<InputIterator>::value_type VT;
return reduce(first, last, init, std::plus<VT>());
return boost::algorithm::reduce(first, last, init, std::plus<VT>());
}
template<class InputIterator>
typename std::iterator_traits<InputIterator>::value_type
reduce(InputIterator first, InputIterator last)
{
return reduce(first, last,
return boost::algorithm::reduce(first, last,
typename std::iterator_traits<InputIterator>::value_type());
}
@ -49,14 +49,14 @@ template<class Range>
typename boost::range_value<Range>::type
reduce(const Range &r)
{
return reduce(boost::begin(r), boost::end(r));
return boost::algorithm::reduce(boost::begin(r), boost::end(r));
}
// Not sure that this won't be ambiguous (1)
template<class Range, class T>
T reduce(const Range &r, T init)
{
return reduce(boost::begin (r), boost::end (r), init);
return boost::algorithm::reduce(boost::begin (r), boost::end (r), init);
}
@ -64,7 +64,7 @@ T reduce(const Range &r, T init)
template<class Range, class T, class BinaryOperation>
T reduce(const Range &r, T init, BinaryOperation bOp)
{
return reduce(boost::begin(r), boost::end(r), init, bOp);
return boost::algorithm::reduce(boost::begin(r), boost::end(r), init, bOp);
}
}} // namespace boost and algorithm