libstdc++: Reuse std::__assign_one in <bits/ranges_algobase.h>
Use std::__assign_one instead of ranges::__assign_one. Adjust the uses, because std::__assign_one has the arguments in the opposite order (the same order as an assignment expression). libstdc++-v3/ChangeLog: * include/bits/ranges_algobase.h (ranges::__assign_one): Remove. (__copy_or_move, __copy_or_move_backward): Use std::__assign_one instead of ranges::__assign_one. Reviewed-by: Patrick Palka <ppalka@redhat.com>
This commit is contained in:
parent
6ecf2b380d
commit
d0a9ae1321
1 changed files with 6 additions and 16 deletions
|
@ -225,16 +225,6 @@ namespace ranges
|
|||
copy_backward_result<_Iter, _Out>>
|
||||
__copy_or_move_backward(_Iter __first, _Sent __last, _Out __result);
|
||||
|
||||
template<bool _IsMove, typename _Iter, typename _Out>
|
||||
constexpr void
|
||||
__assign_one(_Iter& __iter, _Out& __result)
|
||||
{
|
||||
if constexpr (_IsMove)
|
||||
*__result = std::move(*__iter);
|
||||
else
|
||||
*__result = *__iter;
|
||||
}
|
||||
|
||||
template<bool _IsMove,
|
||||
input_iterator _Iter, sentinel_for<_Iter> _Sent,
|
||||
weakly_incrementable _Out>
|
||||
|
@ -294,14 +284,14 @@ namespace ranges
|
|||
__builtin_memmove(__result, __first,
|
||||
sizeof(_ValueTypeI) * __num);
|
||||
else if (__num == 1)
|
||||
ranges::__assign_one<_IsMove>(__first, __result);
|
||||
std::__assign_one<_IsMove>(__result, __first);
|
||||
return {__first + __num, __result + __num};
|
||||
}
|
||||
}
|
||||
|
||||
for (auto __n = __last - __first; __n > 0; --__n)
|
||||
{
|
||||
ranges::__assign_one<_IsMove>(__first, __result);
|
||||
std::__assign_one<_IsMove>(__result, __first);
|
||||
++__first;
|
||||
++__result;
|
||||
}
|
||||
|
@ -311,7 +301,7 @@ namespace ranges
|
|||
{
|
||||
while (__first != __last)
|
||||
{
|
||||
ranges::__assign_one<_IsMove>(__first, __result);
|
||||
std::__assign_one<_IsMove>(__result, __first);
|
||||
++__first;
|
||||
++__result;
|
||||
}
|
||||
|
@ -423,7 +413,7 @@ namespace ranges
|
|||
__builtin_memmove(__result, __first,
|
||||
sizeof(_ValueTypeI) * __num);
|
||||
else if (__num == 1)
|
||||
ranges::__assign_one<_IsMove>(__first, __result);
|
||||
std::__assign_one<_IsMove>(__result, __first);
|
||||
return {__first + __num, __result};
|
||||
}
|
||||
}
|
||||
|
@ -435,7 +425,7 @@ namespace ranges
|
|||
{
|
||||
--__tail;
|
||||
--__result;
|
||||
ranges::__assign_one<_IsMove>(__tail, __result);
|
||||
std::__assign_one<_IsMove>(__result, __tail);
|
||||
}
|
||||
return {std::move(__lasti), std::move(__result)};
|
||||
}
|
||||
|
@ -448,7 +438,7 @@ namespace ranges
|
|||
{
|
||||
--__tail;
|
||||
--__result;
|
||||
ranges::__assign_one<_IsMove>(__tail, __result);
|
||||
std::__assign_one<_IsMove>(__result, __tail);
|
||||
}
|
||||
return {std::move(__lasti), std::move(__result)};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue