boost::system::error_code::swap proposal
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.
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
On Tue, Apr 14, 2009 at 1:22 PM, Marat Abrarov
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.
participants (2)
-
Marat Abrarov
-
Ovanes Markarian