#include <iostream>
using namespace std;
template <typename T, typename U>
struct S
{
unsigned int operator()(T t, U u) const
{
return 1;
}
};
template <typename T>
struct S<T,nullptr_t>
{
bool operator()(T t, nullptr_t u) const
{
return 2;
}
};
class A{};
class B{};
int main() {
A a;
B b;
cout << S<A*,B*>()(&a,&b) << endl;
cout << S<A*,nullptr_t>()(&a,nullptr) << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdGVtcGxhdGUgPHR5cGVuYW1lIFQsIHR5cGVuYW1lIFU+CnN0cnVjdCBTCnsKCXVuc2lnbmVkIGludCBvcGVyYXRvcigpKFQgdCwgVSB1KSBjb25zdAoJewoJCXJldHVybiAxOwoJfQp9OwoKdGVtcGxhdGUgPHR5cGVuYW1lIFQ+CnN0cnVjdCBTPFQsbnVsbHB0cl90Pgp7Cglib29sIG9wZXJhdG9yKCkoVCB0LCBudWxscHRyX3QgdSkgY29uc3QKCXsKCQlyZXR1cm4gMjsKCX0KfTsKCmNsYXNzIEF7fTsKY2xhc3MgQnt9OwoKaW50IG1haW4oKSB7CglBIGE7CglCIGI7CgkKCWNvdXQgPDwgUzxBKixCKj4oKSgmYSwmYikgPDwgZW5kbDsKCWNvdXQgPDwgUzxBKixudWxscHRyX3Q+KCkoJmEsbnVsbHB0cikgPDwgZW5kbDsKCQoJcmV0dXJuIDA7Cn0K