@@ -38,9 +38,9 @@ extension MutableCollection where Self: BidirectionalCollection {
38
38
/// A collection that presents the elements of its base collection
39
39
/// in reverse order.
40
40
///
41
- /// - See also: `ReversedCollection` below.
41
+ /// - See also: `ReversedCollection`
42
42
public protocol ReversedCollectionProtocol : BidirectionalCollection {
43
- /// A `Collection` that can contain the same elements as this one,
43
+ /// A `Collection` that contains the same elements as this one,
44
44
/// just in reverse order.
45
45
associatedtype Elements : Collection where Elements. Iterator. Element == Iterator . Element
46
46
var elements : Elements { get }
@@ -60,8 +60,6 @@ public protocol ReversedCollectionProtocol: BidirectionalCollection {
60
60
/// * `c.reversed()` does not create new storage
61
61
/// * `c.reversed().map(f)` maps eagerly and returns a new array
62
62
/// * `c.lazy.reversed().map(f)` maps lazily and returns a `LazyMapCollection`
63
- ///
64
- /// - See also: `ReversedRandomAccessCollection`
65
63
@_fixed_layout
66
64
public struct ReversedCollection < Base: BidirectionalCollection > {
67
65
public let _base : Base
@@ -274,8 +272,10 @@ extension ReversedCollection: BidirectionalCollection {
274
272
extension ReversedCollection : RandomAccessCollection where Base: RandomAccessCollection { }
275
273
276
274
extension ReversedCollection {
277
- /// This is optimization to return original collection of doubly reversed collection
278
- /// For example [1,2].reversed().reversed() => [1,2]
275
+ // This is optimization to return original collection of doubly reversed collection
276
+ // For example [1,2].reversed().reversed() => [1,2]
277
+
278
+ /// Returns the elements of the original collection (reversal of reversal)
279
279
public func reversed( ) -> Base {
280
280
return _base
281
281
}
@@ -314,8 +314,11 @@ extension BidirectionalCollection {
314
314
}
315
315
316
316
extension LazyCollection where Base: ReversedCollectionProtocol {
317
- /// This is optimization to return original collection of doubly reversed lazy collection
318
- /// For example [1,2].lazy.reversed().reversed() => [1,2].lazy
317
+ // This is optimization to return original collection of doubly reversed lazy collection
318
+ // For example [1,2].lazy.reversed().reversed() => [1,2].lazy
319
+
320
+
321
+ /// Returns the elements of the original lazy collection (reversal of reversal)
319
322
public func reversed( ) -> LazyCollection < Elements . Elements > {
320
323
return elements. elements. lazy
321
324
}
0 commit comments