             buffer = b
         }
     }
-
+    
     /// Append `newElement` to the end of this deque.
     ///
     /// - Complexity: Amortized O(1) if storage isn't shared with another live deque; otherwise O(`count`).

            if i >= start { // Elements before index are not yet wrapped.
                if start >= length { // Neither gap nor elements before it will be wrapped.
                    // ....ABCD̲EF...
                    elements.advancedBy(start - length).moveInitializeFrom(elements.advancedBy(start), count: i - start)
                    // .ABC...D̲EF...
                }
                else if i >= length { // Elements before the gap will be wrapped.
                    // ..ABCD̲EF....
                    elements.advancedBy(capacity + start - length).moveInitializeFrom(elements.advancedBy(start), count: length - start)
                    // ...BCD̲EF...A
                    elements.moveInitializeFrom(elements.advancedBy(length), count: i - length)
                    // BC...D̲EF...A
                }
                else { // Gap will be wrapped
                    // .ABCD̲EF....... (count = 5)
                    elements.advancedBy(capacity + start - length).moveInitializeFrom(elements.advancedBy(start), count: i - start)
                    // ....D̲EF...ABC.
                }
            }
            else { // Elements before index are already wrapped.
                if i >= length { // Gap will not be wrapped.
                    // BCD̲EF......A (count = 1)
                    elements.advancedBy(start - length).moveInitializeFrom(elements.advancedBy(start), count: capacity - start)
                    // BCD̲EF.....A.
                    elements.advancedBy(capacity - length).moveInitializeFrom(elements, count: length)
                    // .CD̲EF.....AB
                    elements.moveInitializeFrom(elements.advancedBy(i - length), count: i - length)
                    // C.D̲EF.....AB
                }
                else { // Gap will be wrapped.
                    // CD̲EF......AB
                    elements.advancedBy(start - length).moveInitializeFrom(elements.advancedBy(start), count: capacity - start)
                    // CD̲EF...AB...
                    elements.advancedBy(capacity - length).moveInitializeFrom(elements, count: i)
                    // .D̲EF...ABC..
                }
            }

            try buffer.forEach(body)
        }
    }
    
    public func map<T>(@noescape transform: (Element) throws -> T) rethrows -> [T] {
        var result: [T] = []
        result.reserveCapacity(self.count)
        try self.forEach { result.append(try transform($0)) }
        return result
    }
    
    public func flatMap<T>(@noescape transform: (Element) throws -> T?) rethrows -> [T] {
        var result: [T] = []
        try self.forEach {
