Make Vector::uncheckedAppend work with move-only types
Created attachment 210667 [details] Patch
Comment on attachment 210667 [details] Patch Awesome! Can't wait for append()!
Committed r155152: <http://trac.webkit.org/changeset/155152>
Comment on attachment 210667 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=210667&action=review > Source/WTF/wtf/Vector.h:646 > + template<typename U> void uncheckedAppend(U&& val); Does removing the old version cause any problems if we want to append something given a const&? Why name this argument, val, here? > Source/WTF/wtf/Vector.h:1071 > +inline void Vector<T, inlineCapacity, OverflowHandler>::uncheckedAppend(U&& val) Why val? How about a word instead of this abbreviation.
(In reply to comment #4) > (From update of attachment 210667 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=210667&action=review > > > Source/WTF/wtf/Vector.h:646 > > + template<typename U> void uncheckedAppend(U&& val); > > Does removing the old version cause any problems if we want to append something given a const&? Nope, what happens if you pass a const T& to it is that U&& will become “const T&” && and reference collapsing will turn that into const T&: struct A { }; template<typename T> void f(T&&) { static_assert(std::is_same<T, const A&>::value, ""); } void g(const A& a) { f(a); } > > Why name this argument, val, here? Good point, I’ll fix. > > > Source/WTF/wtf/Vector.h:1071 > > +inline void Vector<T, inlineCapacity, OverflowHandler>::uncheckedAppend(U&& val) > > Why val? How about a word instead of this abbreviation. Yeah, will fix this too.