1010#ifndef _LIBCPP___ITERATOR_ITER_MOVE_H
1111#define _LIBCPP___ITERATOR_ITER_MOVE_H
1212
13+ #include < __concepts/class_or_enum.h>
1314#include < __config>
1415#include < __iterator/iterator_traits.h>
1516#include < __utility/forward.h>
1617#include < __utility/move.h>
17- #include < concepts> // __class_or_enum
1818#include < type_traits>
1919
2020#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -36,44 +36,32 @@ template <class _Tp>
3636concept __unqualified_iter_move =
3737 __class_or_enum<remove_cvref_t <_Tp>> &&
3838 requires (_Tp&& __t ) {
39- iter_move (_VSTD ::forward<_Tp>(__t ));
39+ iter_move (std ::forward<_Tp>(__t ));
4040 };
4141
42- // [iterator.cust.move]/1
43- // The name ranges::iter_move denotes a customization point object.
44- // The expression ranges::iter_move(E) for a subexpression E is
45- // expression-equivalent to:
42+ // [iterator.cust.move]
43+
4644struct __fn {
47- // [iterator.cust.move]/1.1
48- // iter_move(E), if E has class or enumeration type and iter_move(E) is a
49- // well-formed expression when treated as an unevaluated operand, [...]
5045 template <class _Ip >
51- requires __class_or_enum< remove_cvref_t <_Ip>> && __unqualified_iter_move<_Ip>
46+ requires __unqualified_iter_move<_Ip>
5247 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype (auto ) operator()(_Ip&& __i) const
53- noexcept (noexcept (iter_move(_VSTD ::forward<_Ip>(__i))))
48+ noexcept (noexcept (iter_move(std ::forward<_Ip>(__i))))
5449 {
55- return iter_move (_VSTD ::forward<_Ip>(__i));
50+ return iter_move (std ::forward<_Ip>(__i));
5651 }
5752
58- // [iterator.cust.move]/1.2
59- // Otherwise, if the expression *E is well-formed:
60- // 1.2.1 if *E is an lvalue, std::move(*E);
61- // 1.2.2 otherwise, *E.
6253 template <class _Ip >
63- requires (!(__class_or_enum< remove_cvref_t <_Ip>> && __unqualified_iter_move<_Ip>) ) &&
64- requires (_Ip&& __i) { *_VSTD::forward <_Ip>(__i ); }
54+ requires (!__unqualified_iter_move<_Ip>) &&
55+ requires { *declval <_Ip>(); }
6556 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr decltype (auto ) operator()(_Ip&& __i) const
66- noexcept (noexcept (*_VSTD ::forward<_Ip>(__i)))
57+ noexcept (noexcept (*std ::forward<_Ip>(__i)))
6758 {
68- if constexpr (is_lvalue_reference_v<decltype (*_VSTD::forward <_Ip>(__i ))>) {
69- return _VSTD ::move (*_VSTD ::forward<_Ip>(__i));
59+ if constexpr (is_lvalue_reference_v<decltype (*declval <_Ip>())>) {
60+ return std ::move (*std ::forward<_Ip>(__i));
7061 } else {
71- return *_VSTD ::forward<_Ip>(__i);
62+ return *std ::forward<_Ip>(__i);
7263 }
7364 }
74-
75- // [iterator.cust.move]/1.3
76- // Otherwise, ranges::iter_move(E) is ill-formed.
7765};
7866} // namespace __iter_move
7967
0 commit comments