RESOLVED FIXED 141571
Add a move constructor and move assignment operator to Deque
https://bugs.webkit.org/show_bug.cgi?id=141571
Summary Add a move constructor and move assignment operator to Deque
Anders Carlsson
Reported 2015-02-13 11:43:03 PST
Add a move constructor and move assignment operator to Deque
Attachments
Patch (4.78 KB, patch)
2015-02-13 11:44 PST, Anders Carlsson
kling: review+
Anders Carlsson
Comment 1 2015-02-13 11:44:00 PST
Anders Carlsson
Comment 2 2015-02-13 11:53:01 PST
Darin Adler
Comment 3 2015-02-13 19:10:09 PST
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.
Darin Adler
Comment 4 2015-02-13 19:10:37 PST
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.
Anders Carlsson
Comment 5 2015-02-16 08:12:54 PST
(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.
Note You need to log in before you can comment on or make changes to this bug.