changeset: 4:ca88af4ad101
tag: tip
user: Georg Sauthoff <gsauthof@techfak.uni-bielefeld.de>
date: Thu Aug 06 19:13:18 2009 +0200
summary: pass rhs of assigment operator by value
diff -r 7670ba12e523 -r ca88af4ad101 boost/smart_ptr/intrusive_ptr.hpp
a
|
b
|
|
101 | 101 | if( px != 0 ) intrusive_ptr_release( px ); |
102 | 102 | } |
103 | 103 | |
104 | | #if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES) |
105 | | |
106 | | template<class U> intrusive_ptr & operator=(intrusive_ptr<U> const & rhs) |
107 | | { |
108 | | this_type(rhs).swap(*this); |
109 | | return *this; |
110 | | } |
111 | | |
112 | | #endif |
113 | | |
114 | 104 | // Move support |
115 | 105 | |
116 | 106 | #if defined( BOOST_HAS_RVALUE_REFS ) |
… |
… |
|
128 | 118 | |
129 | 119 | #endif |
130 | 120 | |
131 | | intrusive_ptr & operator=(intrusive_ptr const & rhs) |
| 121 | intrusive_ptr & operator=(intrusive_ptr temp_rhs) |
132 | 122 | { |
133 | | this_type(rhs).swap(*this); |
134 | | return *this; |
135 | | } |
136 | | |
137 | | intrusive_ptr & operator=(T * rhs) |
138 | | { |
139 | | this_type(rhs).swap(*this); |
| 123 | temp_rhs.swap(*this); |
140 | 124 | return *this; |
141 | 125 | } |
142 | 126 | |