Possible Duplicate:
how to provide a swap function for my class?
There are some questions about this, but a lot of contradictions (person A giving solution A' with many upvotes with person B saying it's UB) or "only works if the compiler supports ADL" is answered.
So, say I have the following template (container) class:
template<typename T>
class C {
// ...
void swap(C<T>& y) throw(); // C x; x.swap(y);
}
then what is the correct way to make sure this (example) code works:
C<int> x, y;
std::swap(x, y);
Please give your answer for C++03, and if it still works in C++0x, even better!