Closed Bug 1365654 Opened 8 years ago Closed 8 years ago

Hash table Enum objects cannot be returned from a function

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: jonco, Assigned: jonco)

Details

Attachments

(1 file)

Hash table Enum objects have a deleted copy constructor and hence a deleted move constructor, so you can't do this: using Map = js::HashMap<int, int, js::DefaultHasher<int>, js::SystemAllocPolicy>; Map::Enum enumerateSuff() { return Map::Enum(map); } We should give Enum a move constructor to allow this reasonable behaviour.
Add a move constructor to HashTable::Enum.
Assignee: nobody → jcoppeard
Attachment #8868998 - Flags: review?(luke)
Comment on attachment 8868998 [details] [diff] [review] bug1365654-enum-move Review of attachment 8868998 [details] [diff] [review]: ----------------------------------------------------------------- Makes sense ::: js/src/jsapi-tests/testHashTable.cpp @@ +388,5 @@ > > END_TEST(testHashMapLookupWithDefaultOOM) > #endif // defined(DEBUG) > + > +BEGIN_TEST(testHashTableMovableEnum) Could you add a test that creates an Enum e1, removes an element or two, move-constructs an Enum e2, and then removes a few more elements?
Attachment #8868998 - Flags: review?(luke) → review+
Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/2996f5f166a2 Add a move constructor to HashTable::Enum r=luke
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: