Add assignment operators for mozilla::Pair

RESOLVED FIXED in Firefox 39

Status

()

defect
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: seth, Assigned: seth)

Tracking

unspecified
mozilla39
Points:
---

Firefox Tracking Flags

(firefox39 fixed)

Details

Attachments

(2 attachments)

Now that mozilla::Pair supports copying and moving, we should make it support assignment operators too.
Here's the patch. Trivial, except that again due to MSVC 2013 we can't use "= default" for the move assignment operator.
Attachment #8577531 - Flags: review?(jwalden+bmo)
Comment on attachment 8577531 [details] [diff] [review]
Add assignment operators to mozilla::Pair

Review of attachment 8577531 [details] [diff] [review]:
-----------------------------------------------------------------

Worth adding an assignment to the test file just to exercise this at least a little.

::: mfbt/Pair.h
@@ +167,5 @@
>    Pair(const Pair& aOther) = default;
>  
> +  Pair& operator=(Pair&& aOther)
> +  {
> +    MOZ_ASSERT(this != &aOther, "Self-moves are prohibited");

More common to not capitalize the first letter of an assertion, I think.
Attachment #8577531 - Flags: review?(jwalden+bmo) → review+
Thanks for the review! Pushed:

https://hg.mozilla.org/integration/mozilla-inbound/rev/14e7f9959c85

I'll push a followup to update the test.
Here's that followup. I can't push it right now because inbound is down.
https://hg.mozilla.org/mozilla-central/rev/14e7f9959c85
https://hg.mozilla.org/mozilla-central/rev/098d9685e26f
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in before you can comment on or make changes to this bug.