         return self.heap.storage.isEmpty
     }
 
-    public mutating func pop() -> T? {
+    public mutating func pop() -> Element? {
         assert(self.heap.checkHeapProperty(), "broken heap: \(self.heap.debugDescription)")
         return self.heap.removeRoot()
     }

        return "PriorityQueue(count: \(self.underestimatedCount)): \(Array(self))"
    }
}

}

extension PriorityQueue: Equatable {
    public static func ==(lhs: PriorityQueue<Element>, rhs: PriorityQueue<Element>) -> Bool {
        return Array(lhs) == Array(rhs)
    }
}

extension PriorityQueue: Sequence {
    public struct Iterator: IteratorProtocol {

        private var queue: PriorityQueue<Element>
        fileprivate init(queue: PriorityQueue<Element>) {
            self.queue = queue
        }

        public mutating func next() -> Element? {
            return self.queue.pop()
        }
    }

    public func makeIterator() -> Iterator {
        return Iterator(queue: self)
    }
}

