Make assignment operator unambiguous
Copying a std::deque<mxs::Buffer> would cause a compilation failure due to ambiguity between the copy-assignment and move-assignment operators. Explicitly constructing a temporary object retains the strong exception guarantee but prevents the ambiguity.
This commit is contained in:
parent
43a99886e9
commit
a61c9cfdfa
@ -337,9 +337,10 @@ public:
|
||||
*
|
||||
* @see Buffer::copy_from
|
||||
*/
|
||||
Buffer& operator = (Buffer rhs)
|
||||
Buffer& operator = (const Buffer& rhs)
|
||||
{
|
||||
swap(rhs);
|
||||
Buffer temp(rhs);
|
||||
swap(temp);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user