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:
Markus Mäkelä 2018-04-19 14:31:26 +03:00
parent 43a99886e9
commit a61c9cfdfa
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -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;
}