New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 698998 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Email to this user bounced
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature



Sign in to add a comment

Make WTF Vector support single-argument emplace_back?

Project Member Reported by pdr@chromium.org, Mar 7 2017

Issue description

If you try to emplace_back with a single argument, you will hit an assert:
Vector<MyObject> vector;
myVector.emplaceBack(MyObjectCtorArgs);

static_assert(sizeof...(Args) != 1, "append() must be called instead");

This assert was added before emplace_back used the standard naming [1]. I was confused when I hit this, since it basically means you need to write myVector.push_back(MyObjectCtorArgs). Is this assert useful now that we have stl-like names?

[1] https://codereview.chromium.org/2365533003
 
Owner: mikhail....@intel.com
Status: Assigned (was: Untriaged)
I think these static asserts should be removed so that we take after std::vector behavior.
Project Member

Comment 2 by bugdroid1@chromium.org, Mar 10 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3e1c8c2a1cde9d01f965ce41f71e7ca959740fae

commit 3e1c8c2a1cde9d01f965ce41f71e7ca959740fae
Author: mikhail.pozdnyakov <mikhail.pozdnyakov@intel.com>
Date: Fri Mar 10 12:21:51 2017

Allow WTF::Vector::emplace_back accept one or zero arguments

std::vector has no such limitations, so let's drop them either.
Vector unit test is updated accordingly.

BUG= 698998 

Review-Url: https://codereview.chromium.org/2739813003
Cr-Commit-Position: refs/heads/master@{#456045}

[modify] https://crrev.com/3e1c8c2a1cde9d01f965ce41f71e7ca959740fae/third_party/WebKit/Source/wtf/Vector.h
[modify] https://crrev.com/3e1c8c2a1cde9d01f965ce41f71e7ca959740fae/third_party/WebKit/Source/wtf/VectorTest.cpp

Status: Fixed (was: Assigned)

Comment 4 by pdr@chromium.org, Mar 10 2017

Thank you Mikhail!

Sign in to add a comment