When arguments of a function belong to a specific namespace, C++ searches for the function in the arguments’ namespace instead of the global namespace.
#include <algorithm>
using std::swap;
namespace wat {
struct test_t {};
void swap(test_t &a, test_t &b) {
test_t c = a;
a = b;
b = c;
}
}
int main() {
wat::test_t a, b;
swap(a, b); // calls wat::swap
return 0;
}