
27 May
2010
27 May
'10
9:55 a.m.
On Thu, May 27, 2010 at 2:30 AM, Tomas Puverle <Tomas.Puverle@morganstanley.com> wrote: [...]
My point was about the fact that if you have two functions with the following signatures
template<typename T> void swap(T & t);
template<typename T> T swap(const T & t);
when the user has this
int i;
then there is no way to specify whether or not he wants the copying or the swap-in-place version (ok, I can think of a way but I think it's way too convoluted)
Static casting?
swap(i); //what does this mean?
I was just trying to explain why I chose to have a swap_in_place<>() rather than rely on overloading.
The biggest reason not to do that, IMHO, is that oveloards should always have the same behavior. -- gpd