Bug 120223 - Cut down repeated code in RefPtr and RetainPtr by using copy/move-and-swap for assignment operators
Summary: Cut down repeated code in RefPtr and RetainPtr by using copy/move-and-swap fo...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Darin Adler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-23 12:52 PDT by Darin Adler
Modified: 2013-09-12 01:11 PDT (History)
4 users (show)

See Also:


Attachments
Patch (5.68 KB, patch)
2013-08-23 12:54 PDT, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (7.08 KB, patch)
2013-08-23 13:03 PDT, Darin Adler
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2013-08-23 12:52:03 PDT
Cut down repeated code in RefPtr and RetainPtr by using copy/move-and-swap for assignment operators
Comment 1 Darin Adler 2013-08-23 12:54:01 PDT
Created attachment 209496 [details]
Patch
Comment 2 Darin Adler 2013-08-23 13:03:10 PDT
Created attachment 209497 [details]
Patch
Comment 3 Darin Adler 2013-08-23 13:42:04 PDT
Committed r154519: <http://trac.webkit.org/changeset/154519>
Comment 4 Mikhail Pozdnyakov 2013-09-12 01:11:48 PDT
What do you think about:

 template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(RefPtr o)
 {
     swap(o);
     return *this;
 }

This looks even shorter :)