18
18
///
19
19
/// - SeeAlso: https://en.cppreference.com/w/cpp/named_req/InputIterator
20
20
public protocol UnsafeCxxInputIterator : Equatable {
21
- associatedtype Pointee : ~ Copyable
21
+ associatedtype Pointee
22
22
23
23
/// Returns the unwrapped result of C++ `operator*()`.
24
24
///
@@ -34,23 +34,19 @@ public protocol UnsafeCxxInputIterator: Equatable {
34
34
func successor( ) -> Self
35
35
}
36
36
37
- extension UnsafePointer : UnsafeCxxInputIterator
38
- where Pointee: ~ Copyable { }
37
+ extension UnsafePointer : UnsafeCxxInputIterator { }
39
38
40
- extension UnsafeMutablePointer : UnsafeCxxInputIterator
41
- where Pointee: ~ Copyable { }
39
+ extension UnsafeMutablePointer : UnsafeCxxInputIterator { }
42
40
43
41
extension Optional : UnsafeCxxInputIterator where Wrapped: UnsafeCxxInputIterator {
44
42
public typealias Pointee = Wrapped . Pointee
45
43
46
44
@inlinable
47
45
public var pointee : Pointee {
48
- _read {
49
- guard let value = self else {
50
- fatalError ( " Could not dereference nullptr " )
51
- }
52
- yield value. pointee
46
+ if let value = self {
47
+ return value. pointee
53
48
}
49
+ fatalError ( " Could not dereference nullptr " )
54
50
}
55
51
56
52
@inlinable
@@ -67,8 +63,7 @@ public protocol UnsafeCxxMutableInputIterator: UnsafeCxxInputIterator {
67
63
override var pointee : Pointee { get set }
68
64
}
69
65
70
- extension UnsafeMutablePointer : UnsafeCxxMutableInputIterator
71
- where Pointee: ~ Copyable { }
66
+ extension UnsafeMutablePointer : UnsafeCxxMutableInputIterator { }
72
67
73
68
/// Bridged C++ iterator that allows computing the distance between two of its
74
69
/// instances, and advancing an instance by a given number of elements.
@@ -84,14 +79,11 @@ public protocol UnsafeCxxRandomAccessIterator: UnsafeCxxInputIterator {
84
79
static func += ( lhs: inout Self , rhs: Distance )
85
80
}
86
81
87
- extension UnsafePointer : UnsafeCxxRandomAccessIterator
88
- where Pointee: ~ Copyable { }
82
+ extension UnsafePointer : UnsafeCxxRandomAccessIterator { }
89
83
90
- extension UnsafeMutablePointer : UnsafeCxxRandomAccessIterator
91
- where Pointee: ~ Copyable { }
84
+ extension UnsafeMutablePointer : UnsafeCxxRandomAccessIterator { }
92
85
93
86
public protocol UnsafeCxxMutableRandomAccessIterator :
94
87
UnsafeCxxRandomAccessIterator , UnsafeCxxMutableInputIterator { }
95
88
96
- extension UnsafeMutablePointer : UnsafeCxxMutableRandomAccessIterator
97
- where Pointee: ~ Copyable { }
89
+ extension UnsafeMutablePointer : UnsafeCxxMutableRandomAccessIterator { }
0 commit comments