Closed
Bug 1096095
Opened 11 years ago
Closed 11 years ago
nsTArray should support in-place construction
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
DUPLICATE
of bug 1571759
People
(Reporter: xidorn, Unassigned)
Details
Some classes do not have reliable copy or move ctors (e.g. nsLineLayout), which makes it hard to store them in nsTArray. I suggest that nsTArray should have methods for in-place construction for those types to avoid using copy ctors.
The current workaround could be wraping a Maybe, which supports in-place construction, inside the nsTArray. But I don't think it's an optimal way.
Reporter | ||
Updated•11 years ago
|
Component: MFBT → XPCOM
![]() |
||
Comment 1•11 years ago
|
||
Doesn't AppendElement() with no argument do in-place construction?
Reporter | ||
Comment 2•11 years ago
|
||
(In reply to Please do not ask for reviews for a bit [:bz] from comment #1)
> Doesn't AppendElement() with no argument do in-place construction?
Yes, but I meant in-place construction with parameter, like Maybe::emplace.
Well, I no longer think it is useful now, since classes which cannot be copied or moved should never be directly stored in a nsTArray.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
Comment 3•5 years ago
|
||
In the meantime, nsTArray_Impl::EmplaceBack
was added.
Updated•5 years ago
|
Resolution: INVALID → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•