10
10
#ifndef _LIBCPP___ITERATOR_ITER_MOVE_H
11
11
#define _LIBCPP___ITERATOR_ITER_MOVE_H
12
12
13
+ #include < __concepts/class_or_enum.h>
13
14
#include < __config>
14
15
#include < __iterator/iterator_traits.h>
15
16
#include < __utility/forward.h>
16
17
#include < __utility/move.h>
17
- #include < concepts> // __class_or_enum
18
18
#include < type_traits>
19
19
20
20
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -36,44 +36,32 @@ template <class _Tp>
36
36
concept __unqualified_iter_move =
37
37
__class_or_enum<remove_cvref_t <_Tp>> &&
38
38
requires (_Tp&& __t ) {
39
- iter_move (_VSTD ::forward<_Tp>(__t ));
39
+ iter_move (std ::forward<_Tp>(__t ));
40
40
};
41
41
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
+
46
44
struct __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, [...]
50
45
template <class _Ip >
51
- requires __class_or_enum< remove_cvref_t <_Ip>> && __unqualified_iter_move<_Ip>
46
+ requires __unqualified_iter_move<_Ip>
52
47
[[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))))
54
49
{
55
- return iter_move (_VSTD ::forward<_Ip>(__i));
50
+ return iter_move (std ::forward<_Ip>(__i));
56
51
}
57
52
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.
62
53
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>(); }
65
56
[[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)))
67
58
{
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));
70
61
} else {
71
- return *_VSTD ::forward<_Ip>(__i);
62
+ return *std ::forward<_Ip>(__i);
72
63
}
73
64
}
74
-
75
- // [iterator.cust.move]/1.3
76
- // Otherwise, ranges::iter_move(E) is ill-formed.
77
65
};
78
66
} // namespace __iter_move
79
67
0 commit comments