I assume you can't implement it more effecient as using a default std::swap, which does it with any copyable object, e.g.
namespace std
{
template<class T>
void swap(T& lhs, T& rhs)
{
T tmp=lhs;
lhs = rhs, rhs = tmp;
}
}
specializing/oveloading swap makes sence only if you can exchange pointers instead of copying large content (like std::vector or any other collection). With error_code it is not the case.
Greetings,
Ovanes
Why boost::system::error_code doesn't have swap method (or overloaded swap
friend function)?
boost::system::error_code is copyable so it must have such "swap".
Any opinions?
Best regards,
Marat Abrarov.