Closed Bug 1665462 Opened 5 years ago Closed 5 years ago

Add Vector::appendAll with move semantics

Categories

(Core :: MFBT, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: arai, Assigned: sg)

Details

Attachments

(2 files)

We have the following:

template <typename T, size_t MinInlineCapacity = 0,
          class AllocPolicy = MallocAllocPolicy>
class MOZ_NON_PARAM Vector final : private AllocPolicy {
...
template <typename U, size_t O, class BP>
  MOZ_MUST_USE bool appendAll(const Vector<U, O, BP>& aU);

that uses copy-semantics, and if T/U doesn't support copy, this doesn't work.

bug 1665387 will require concatenating vectors that contains not-copy-able elements,
and the passed vector doesn't have to be kept after the concatenation.

It would be nice to provide appendAll with move semantics, that moves all elements, and clears the passed vector.

Assignee: nobody → sgiesecke
Status: NEW → ASSIGNED

Sorry for the delay, I'll get to these either later today or sometime tomorrow.

Pushed by sgiesecke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fc6b7d8f4d98 Add moving Vector::appendAll(Vector&&) overload. r=jwalden https://hg.mozilla.org/integration/autoland/rev/3ba6cafe48d8 Use moving Vector::appendAll overload at a few places, or use move assignment. r=jwalden
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: