[libc++] ADL-proof <iterator>. `__convert_to_integral` is not a customization point.
The interesting change here is that we no longer consider `__convert_to_integral`
an ADL customization point for the user's types. I think the new behavior
is defensible. The old behavior had come from D7449, where Marshall explicitly
said "people can't define their own [`__convert_to_integral` overloads]."
Differential Revision: https://reviews.llvm.org/D92814
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 3bb6c78..7944f9b 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -895,7 +895,7 @@
_InputIterator
for_each_n(_InputIterator __first, _Size __orig_n, _Function __f)
{
- typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
+ typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize;
_IntegralSize __n = __orig_n;
while (__n > 0)
{
@@ -1614,7 +1614,7 @@
_Size __count, const _Tp& __value_, _BinaryPredicate __pred)
{
return _VSTD::__search_n<typename add_lvalue_reference<_BinaryPredicate>::type>
- (__first, __last, __convert_to_integral(__count), __value_, __pred,
+ (__first, __last, _VSTD::__convert_to_integral(__count), __value_, __pred,
typename iterator_traits<_ForwardIterator>::iterator_category());
}
@@ -1625,7 +1625,7 @@
search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_)
{
typedef typename iterator_traits<_ForwardIterator>::value_type __v;
- return _VSTD::search_n(__first, __last, __convert_to_integral(__count),
+ return _VSTD::search_n(__first, __last, _VSTD::__convert_to_integral(__count),
__value_, __equal_to<__v, _Tp>());
}
@@ -1827,7 +1827,7 @@
>::type
copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
{
- typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
+ typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize;
_IntegralSize __n = __orig_n;
if (__n > 0)
{
@@ -1852,7 +1852,7 @@
>::type
copy_n(_InputIterator __first, _Size __orig_n, _OutputIterator __result)
{
- typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
+ typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize;
_IntegralSize __n = __orig_n;
return _VSTD::copy(__first, __first + __n, __result);
}
@@ -2057,7 +2057,7 @@
_OutputIterator
fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
{
- return _VSTD::__fill_n(__first, __convert_to_integral(__n), __value_);
+ return _VSTD::__fill_n(__first, _VSTD::__convert_to_integral(__n), __value_);
}
// fill
@@ -2105,7 +2105,7 @@
_OutputIterator
generate_n(_OutputIterator __first, _Size __orig_n, _Generator __gen)
{
- typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
+ typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize;
_IntegralSize __n = __orig_n;
for (; __n > 0; ++__first, (void) --__n)
*__first = __gen();