Closed Bug 1053420 Opened 10 years ago Closed 10 years ago

Improve new nsTArray rvalue reference methods

Categories

(Core :: XPCOM, defect)

defect
Not set
trivial

Tracking

()

RESOLVED FIXED
mozilla34

People

(Reporter: neil, Assigned: neil)

References

Details

Attachments

(1 file)

The new rvalue reference versions of nsTArray::AppendElement and InsertElementAt want to move their parameter to the Construct function. Since this isn't a template-deduced reference parameter, they should Move rather than Forward.

It looks as if jrmuizel did originally try to template on the parameter to AppendElement but was just trying various combinations until it compiled :-\

Note that template<class Item> elem_type* AppendElement(elem_type&& aItem) matches non-const lvalues which is why you can't blindly Move them. In fact it quite happily takes const lvalues too, making the other overload redundant.
My second try run (the first got hit by our infra issues) for my suggested AppendElement change seems to be reasonably green. Patch is at https://hg.mozilla.org/try/rev/9922524dc8dd
Attached patch Proposed patchSplinter Review
https://tbpl.mozilla.org/?tree=Try&rev=34a6b9a59e6d
Assignee: nobody → neil
Status: NEW → ASSIGNED
Attachment #8473357 - Flags: review?(nfroyd)
Attachment #8473357 - Flags: review?(nfroyd) → review+
I botched the bug# on my checkin comment. Oops.

https://hg.mozilla.org/mozilla-central/rev/2976adaf3278
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: