Closed Bug 1184385 Opened 4 years ago Closed 4 years ago

Implement an equivalent of std::tie in mfbt/Tuple.h

Categories

(Core :: MFBT, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: seth, Assigned: botond)

References

Details

Attachments

(1 file)

std::tie is really handy for making code that involves std::pair more readable. In addition it's handy generally for working with tuples. Let's implement an equivalent.
Bug 1184385 - Add a Tie() utility function for tuples (the equivalent of std::tie()) to MFBT. r=froydnj
Attachment #8635729 - Flags: review?(nfroyd)
Build-only Try push:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=9d125020356c
Assignee: nobody → botond
Comment on attachment 8635729 [details]
MozReview Request: Bug 1184385 - Add a Tie() utility function for tuples (the equivalent of std::tie()) to MFBT. r=froydnj

https://reviewboard.mozilla.org/r/13601/#review12245

::: mfbt/tests/TestTuple.cpp:151
(Diff revision 1)
> +  return true;

Since we want Tie to work automatically with conversion, is it worth adding a test that actually requires conversion when assigning to the elements?  Or writing a standalone test to ensure converting elements works?
Attachment #8635729 - Flags: review?(nfroyd) → review+
Comment on attachment 8635729 [details]
MozReview Request: Bug 1184385 - Add a Tie() utility function for tuples (the equivalent of std::tie()) to MFBT. r=froydnj

Bug 1184385 - Add a Tie() utility function for tuples (the equivalent of std::tie()) to MFBT. r=froydnj
Attachment #8635729 - Flags: review+ → review?(nfroyd)
Comment on attachment 8635729 [details]
MozReview Request: Bug 1184385 - Add a Tie() utility function for tuples (the equivalent of std::tie()) to MFBT. r=froydnj

Updated test to add a part involving conversions. Carrying r+.

New build-only Try push:
  https://treeherder.mozilla.org/#/jobs?repo=try&revision=f4e99b80b5ed
Attachment #8635729 - Flags: review?(nfroyd) → review+
Blocks: 1185706
https://hg.mozilla.org/mozilla-central/rev/1804dea1fadd
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.