#include <iostream>
namespace a
{
struct Test
{
};
}
namespace b
{
struct Test
{
};
void f(Test &)
{
std::cout << "b::f(b::Test)" << std::endl;
}
void f(a::Test &, Test &)
{
std::cout << "b::f(a::Test, b::Test)" << std::endl;
}
}
namespace a
{
void f(Test &)
{
std::cout << "a::f(a::Test)" << std::endl;
}
void f(Test &, b::Test &)
{
std::cout << "a::f(a::Test, b::Test)" << std::endl;
}
}
int main()
{
a::Test t1;
b::Test t2;
f(t1);
f(t2);
//f(t1, t2); // ideone.com/vC1xl9
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKbmFtZXNwYWNlIGEKewoJc3RydWN0IFRlc3QKCXsKCX07Cn0KCm5hbWVzcGFjZSBiCnsKCXN0cnVjdCBUZXN0Cgl7Cgl9OwoJdm9pZCBmKFRlc3QgJikKCXsKCQlzdGQ6OmNvdXQgPDwgImI6OmYoYjo6VGVzdCkiIDw8IHN0ZDo6ZW5kbDsKCX0KCXZvaWQgZihhOjpUZXN0ICYsIFRlc3QgJikKCXsKCQlzdGQ6OmNvdXQgPDwgImI6OmYoYTo6VGVzdCwgYjo6VGVzdCkiIDw8IHN0ZDo6ZW5kbDsKCX0KfQoKbmFtZXNwYWNlIGEKewoJdm9pZCBmKFRlc3QgJikKCXsKCQlzdGQ6OmNvdXQgPDwgImE6OmYoYTo6VGVzdCkiIDw8IHN0ZDo6ZW5kbDsKCX0KCXZvaWQgZihUZXN0ICYsIGI6OlRlc3QgJikKCXsKCQlzdGQ6OmNvdXQgPDwgImE6OmYoYTo6VGVzdCwgYjo6VGVzdCkiIDw8IHN0ZDo6ZW5kbDsKCX0KfQoKaW50IG1haW4oKQp7CglhOjpUZXN0IHQxOwoJYjo6VGVzdCB0MjsKCglmKHQxKTsKCWYodDIpOwoJLy9mKHQxLCB0Mik7IC8vIGlkZW9uZS5jb20vdkMxeGw5Cn0K