As comment in the top part of WebVector.h says WebVector::swap should be used in such cases. If you write by mistake something as follows: WebVector<WebString> a(3); WebVector<WebString> b; b = a; operator= automatically generated by compiler will be invoked as it takes precedence over template version template <typename C> WebVector<T>& operator=(const C& other) The default assignment operator will lead to a.m_ptr == b.m_ptr and to destructor being called twice for the container elements. So either operator= should have valid implementation or be disallowed explicitly.
Created attachment 44598 [details] patch Not sure where I could place unit test for this.
style-queue ran check-webkit-style on attachment 44598 [details] without any errors.
Comment on attachment 44598 [details] patch We have wtf/Noncopyable for this sort of thing. But that can't be used here, so this is probably fine.
Comment on attachment 44598 [details] patch Actually, the intent was to allow copying just as you can copy a std::vector or a WTF::Vector. I think we should implement this assignment operator.
Created attachment 44797 [details] patch addressing reviewers comments
style-queue ran check-webkit-style on attachment 44797 [details] without any errors.
(In reply to comment #4) > (From update of attachment 44598 [details]) > Actually, the intent was to allow copying just as you can copy a std::vector or > a WTF::Vector. I think we should implement this assignment operator. Done. I've added "non-template" operator=.
Committing to http://svn.webkit.org/repository/webkit/trunk ... M WebKit/chromium/ChangeLog M WebKit/chromium/public/WebVector.h Committed r52255