1818///
1919/// - SeeAlso: https://en.cppreference.com/w/cpp/named_req/InputIterator
2020public protocol UnsafeCxxInputIterator : Equatable {
21- associatedtype Pointee : ~ Copyable
21+ associatedtype Pointee
2222
2323 /// Returns the unwrapped result of C++ `operator*()`.
2424 ///
@@ -34,23 +34,19 @@ public protocol UnsafeCxxInputIterator: Equatable {
3434 func successor( ) -> Self
3535}
3636
37- extension UnsafePointer : UnsafeCxxInputIterator
38- where Pointee: ~ Copyable { }
37+ extension UnsafePointer : UnsafeCxxInputIterator { }
3938
40- extension UnsafeMutablePointer : UnsafeCxxInputIterator
41- where Pointee: ~ Copyable { }
39+ extension UnsafeMutablePointer : UnsafeCxxInputIterator { }
4240
4341extension Optional : UnsafeCxxInputIterator where Wrapped: UnsafeCxxInputIterator {
4442 public typealias Pointee = Wrapped . Pointee
4543
4644 @inlinable
4745 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
5348 }
49+ fatalError ( " Could not dereference nullptr " )
5450 }
5551
5652 @inlinable
@@ -67,8 +63,7 @@ public protocol UnsafeCxxMutableInputIterator: UnsafeCxxInputIterator {
6763 override var pointee : Pointee { get set }
6864}
6965
70- extension UnsafeMutablePointer : UnsafeCxxMutableInputIterator
71- where Pointee: ~ Copyable { }
66+ extension UnsafeMutablePointer : UnsafeCxxMutableInputIterator { }
7267
7368/// Bridged C++ iterator that allows computing the distance between two of its
7469/// instances, and advancing an instance by a given number of elements.
@@ -84,14 +79,11 @@ public protocol UnsafeCxxRandomAccessIterator: UnsafeCxxInputIterator {
8479 static func += ( lhs: inout Self , rhs: Distance )
8580}
8681
87- extension UnsafePointer : UnsafeCxxRandomAccessIterator
88- where Pointee: ~ Copyable { }
82+ extension UnsafePointer : UnsafeCxxRandomAccessIterator { }
8983
90- extension UnsafeMutablePointer : UnsafeCxxRandomAccessIterator
91- where Pointee: ~ Copyable { }
84+ extension UnsafeMutablePointer : UnsafeCxxRandomAccessIterator { }
9285
9386public protocol UnsafeCxxMutableRandomAccessIterator :
9487UnsafeCxxRandomAccessIterator , UnsafeCxxMutableInputIterator { }
9588
96- extension UnsafeMutablePointer : UnsafeCxxMutableRandomAccessIterator
97- where Pointee: ~ Copyable { }
89+ extension UnsafeMutablePointer : UnsafeCxxMutableRandomAccessIterator { }
0 commit comments