   var storage_: Storage
 }
 
-extension CircularArray {
-  public func withUnsafeBufferPointer<R>(
-    @noescape body: (UnsafeBufferPointer<Element>) throws -> R
-  ) rethrows -> R {
-    return try storage_.withUnsafeBufferPointer(body)
-  }
-  
-  public func withUnsafeMutableBufferPointer<R>(
-    @noescape body: (UnsafeMutableBufferPointer<Element>) throws -> R
-  ) rethrows -> R {
-    return try storage_.withUnsafeMutableBufferPointer(body)
-  }
-  
-  mutating func makeMutableAndUnique() {
-    if !isUniquelyReferencedNonObjC(&storage_) {
-      storage_ = CircularArrayBuffer(buffer: storage_)
-    }
-  }
-}
-
 extension CircularArray : DequeCollectionType {
+  /// Reserve enough space to store `minimumCapacity` elements.
+  ///
+  /// - Postcondition: `capacity >= minimumCapacity` and the circular array has
+  ///   mutable contiguous storage.
+  ///
+  /// - Complexity: O(`self.count`).
   public mutating func reserveCapacity(minimumCapacity: Int) {
-    makeMutableAndUnique()
+    makeUniqueMutableStorage()
     storage_.reserveCapacity(minimumCapacity)
   }
   
+  /// Prepends `newElement` to the `CircularArray`.
+  ///
+  /// Invalidates all indices with respect to `self`.
+  ///
+  /// - Complexity: amortized O(1).
   public mutating func prepend(newElement: Element) {
-    makeMutableAndUnique()
+    makeUniqueMutableStorage()
     storage_.prepend(newElement)
   }
   
+  /// Prepends the elements of `newElements` to the `CircularArray`.
+  ///
+  /// - Complexity: O(*length of `newElements`*).
   public mutating func prependContentsOf<
     S : SequenceType where S.Generator.Element == Element
   >(newElements: S) {

    }
  }
  
  public mutating func appendContentsOf<
    C : CollectionType where C.Generator.Element == Element
  >(newElements: C) {

//  Copyright © 2016 José Massada. All rights reserved.
//

/// A fast, double-ended queue of `Element` implemented with a modified dynamic
/// array.
public struct CircularArray<Element> : ArrayLiteralConvertible {
  typealias Storage = CircularArrayBuffer<Element>
  
