Add a move constructor and move assignment operator to Deque
Created attachment 246539 [details] Patch
Committed r180066: <http://trac.webkit.org/changeset/180066>
Comment on attachment 246539 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=246539&action=review > Source/WTF/wtf/Deque.h:327 > template<typename T, size_t inlineCapacity> > +inline auto Deque<T, inlineCapacity>::operator=(Deque&& other) -> Deque& > +{ > + swap(other); > + return *this; > +} This isn’t right. We need to clear other after swapping, I think.
Comment on attachment 246539 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=246539&action=review > Tools/TestWebKitAPI/Tests/WTF/Deque.cpp:182 > + EXPECT_EQ(10u, deque2.size()); That doesn’t seem right. deque2’s size should be zero.
(In reply to comment #3) > Comment on attachment 246539 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=246539&action=review > > > Source/WTF/wtf/Deque.h:327 > > template<typename T, size_t inlineCapacity> > > +inline auto Deque<T, inlineCapacity>::operator=(Deque&& other) -> Deque& > > +{ > > + swap(other); > > + return *this; > > +} > > This isn’t right. We need to clear other after swapping, I think. Move constructors don't have to clear out the original; they only need to leave the moved-from object in a valid (but indeterminate) state.