Open Bug 743865 Opened 12 years ago Updated 2 years ago

Allow HashMaps with non-default-constructible keys

Categories

(Core :: JavaScript Engine, defect)

Other Branch
defect

Tracking

()

People

(Reporter: jorendorff, Unassigned)

Details

Currently js::HashMap<K, V, ...> requires K and V to be default-constructible, but I think this is only because js::detail::HashTableEntry contains these methods:

    void setFree()                { keyHash = sFreeKey; t = T(); }
    void setRemoved()             { keyHash = sRemovedKey; t = T(); }

HashTableEntry would have to be rewritten to call t's destructor
when changing state from live to free or removed.

As a prerequisite, we would need to JS_ASSERT(found()) in these methods of HashTable::Ptr:

        T &operator*() const                  { return entry->t; }
        T *operator->() const                 { return &entry->t; }
Assignee: general → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.