||(Concrete*) -> bool
||Define two collection templates, js::OrderedHashMap and js::OrderedHashSet.
They are like js::HashMap and js::HashSet except that:
- Iterating over an Ordered hash table visits the entries in the order in
which they were inserted. This means that unlike a HashMap, the behavior
of an OrderedHashMap is deterministic (as long as the HashPolicy methods
are effect-free and consistent); the hashing is a pure performance
- Range objects over Ordered tables remain valid even when entries are
added or removed or the table is resized. (However in the case of
removing entries, note the warning on class Range below.)
- The API is a little different, so it's not a drop-in replacement.
In particular, the hash policy is a little different.
Also, the Ordered templates lack the Ptr and AddPtr types.
See the comment about "Hash policy" in HashTable.h for general features that
hash policy classes must provide. Hash policies for OrderedHashMaps and Sets
differ in that the hash() method takes an extra argument:
static js::HashNumber hash(Lookup, const HashCodeScrambler&);
They must additionally provide a distinguished "empty" key value and the
following static member functions:
bool isEmpty(const Key&);
||Class which represents a heap based priority queue using a vector.
Inserting elements and removing the highest priority one are both O(log n).
Template parameters are the same as for Vector, with the addition that P
must have a static priority(const T&) method which returns higher numbers
for higher priority elements.
||Helper function for MergeSort.