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:
@ -337,9 +337,10 @@ public:
|
|||||||
*
|
*
|
||||||
* @see Buffer::copy_from
|
* @see Buffer::copy_from
|
||||||
*/
|
*/
|
||||||
Buffer& operator = (Buffer rhs)
|
Buffer& operator = (const Buffer& rhs)
|
||||||
{
|
{
|
||||||
swap(rhs);
|
Buffer temp(rhs);
|
||||||
|
swap(temp);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user