Closed Bug 1216611 Opened 9 years ago Closed 9 years ago

add a MakeUniqueFallible<T[]> (and maybe <T>) function

Categories

(Core :: MFBT, defect)

43 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox44 --- fixed
firefox45 --- fixed
b2g-v2.5 --- fixed

People

(Reporter: froydnj, Unassigned)

Details

Attachments

(2 files)

In converting a few nsAuto*Ptr things to UniquePtr, one pattern that comes up is: mAutoPtr = new (fallible) T[...]; which has to be converted like so: mUniquePtr.reset(new (fallible) T[...]); I think converting it like so would be nicer: mUniquePtr = MakeUniqueFallible<T[]>(...); which is a little longer, but reads a little more idiomatically and doesn't use |new|.
Reasonable. Separate header from the existing, is all I want here. :-) If we adopt <memory> at some point, want to keep extensions separated out.
How about mUniquePtr = MakeUnique<T[]>(..., fallible) ?
Don't think so. It seems very worth preserving the sense that the arguments passed in, are exactly passed along. Not to mention there'd then be ambiguity with a constructor that took a |fallible| as its last argument.
Chose to call the file MakeUniqueExtensions in case we ever want to have UniqueFreePtr etc.
Attachment #8682614 - Flags: review?(jwalden+bmo)
Attachment #8682614 - Flags: review?(jwalden+bmo) → review+
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Approval Request Comment [Feature/regressing bug #]: none [User impact if declined]: need this to uplift bug 1235605 [Describe test coverage new/current, TreeHerder]: none [Risks and why]: safe [String/UUID change made/needed]: none
Attachment #8703908 - Flags: feedback?(nfroyd)
Attachment #8703908 - Flags: approval-mozilla-beta?
Comment on attachment 8703908 [details] [diff] [review] header only uplift for beta Review of attachment 8703908 [details] [diff] [review]: ----------------------------------------------------------------- LGTM!
Attachment #8703908 - Flags: feedback?(nfroyd) → feedback+
Comment on attachment 8703908 [details] [diff] [review] header only uplift for beta Need to fix a sec-mod issue. Beta44+
Attachment #8703908 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: