Skip to main content
added 209 characters in body
Source Link
Sebastian Redl
  • 73.9k
  • 8
  • 137
  • 177

Keep to the standard swap idiom, and you won't have a problem:

void call_swap(A& other) { using std::swap; swap(*this, other); } 

Or use the Boost.Swap wrapper:

void call_swap(A& other) { boost::swap(*this, other); } 

This is pretty much equivalent to @Juan's solution, except you're not writing the helper yourself.

Keep to the standard swap idiom, and you won't have a problem:

void call_swap(A& other) { using std::swap; swap(*this, other); } 

Keep to the standard swap idiom, and you won't have a problem:

void call_swap(A& other) { using std::swap; swap(*this, other); } 

Or use the Boost.Swap wrapper:

void call_swap(A& other) { boost::swap(*this, other); } 

This is pretty much equivalent to @Juan's solution, except you're not writing the helper yourself.

Source Link
Sebastian Redl
  • 73.9k
  • 8
  • 137
  • 177

Keep to the standard swap idiom, and you won't have a problem:

void call_swap(A& other) { using std::swap; swap(*this, other); }