We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8353b4c commit a009ae2Copy full SHA for a009ae2
stdlib/public/core/Reverse.swift
@@ -253,6 +253,19 @@ extension ReversedCollection: BidirectionalCollection {
253
254
extension ReversedCollection: RandomAccessCollection where Base: RandomAccessCollection { }
255
256
+extension ReversedCollection {
257
+ /// This is optimization to return identity of doubly reversed collection
258
+ /// For example [1,2].reversed().reversed() => [1,2]
259
+ ///
260
+ /// Returns a view presenting the elements of the collection in reverse
261
+ /// order.
262
263
+ /// - Complexity: O(1)
264
+ public func reversed() -> Base {
265
+ return _base
266
+ }
267
+}
268
+
269
extension BidirectionalCollection {
270
/// Returns a view presenting the elements of the collection in reverse
271
/// order.
0 commit comments