Closed Bug 819523 Opened 13 years ago Closed 12 years ago

Make it possible to pass any TArray (fallible or not) to a const ref taking any other TArray (fallible or not)

Categories

(Core :: XPCOM, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(3 files, 1 obsolete file)

Since if people don't cast away const they can't use the allocator anyway.
Peter, I can understand if you don't want to take this black magic....
Attachment #690049 - Flags: review?(peterv)
Attachment #690051 - Flags: review?(peterv)
Attachment #690049 - Attachment is obsolete: true
Attachment #690049 - Flags: review?(peterv)
Comment on attachment 690047 [details] [diff] [review] part 1. Make it possible to use the various-allocator nsTArrays interchangeably as long as you're working with const objects. > + // Allow converting to a const array with a different kind of allocator, > + // Since the allocator doesn't matter for const arrays Would you mind changing the second line so it begins with a lower-case letter and ends with a period? r=me, and thanks for writing a test!
Attachment #690047 - Flags: review?(justin.lebar+bug) → review+
Comment on attachment 690051 [details] [diff] [review] Part 2, even compiling > + // mIsNull MUST COME FIRST because otherwise the casting in our array > + // conversion operators would shift where it is found in the struct. > + bool mIsNull; > T mValue; > - bool mIsNull; > > public: > Nullable() > : mIsNull(true) > {} > > - Nullable(T aValue) > + explicit Nullable(T aValue) > : mValue(aValue) > , mIsNull(false) -Werror on tinderbox doesn't like the fact that the initialization list's order doesn't match the order of the members.
Ah, thank you. Good catch. I'm being tempted to land part 1 and not worry about part 2, fwiw...
Comment on attachment 690051 [details] [diff] [review] Part 2, even compiling r=me, fwiw. Are you OK if I land these two patches along with bug 819791?
Attachment #690051 - Flags: review+
Yes, go for it! Three patches, that is, counting your initializer reordering.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Attachment #690051 - Flags: review?(peterv) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: