Make WTF Vector support single-argument emplace_back? |
||
Issue descriptionIf 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
,
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
,
Mar 10 2017
,
Mar 10 2017
Thank you Mikhail! |
||
►
Sign in to add a comment |
||
Comment 1 by mikhail....@intel.com
, Mar 8 2017Status: Assigned (was: Untriaged)