#include <iostream>
class A {};
class B {};
class A1 {};
class B1 {};
template<class A, class B, bool AisA1 = std::is_same<A,A1>::value>
class Class { public: void hello() {std::cout << "Base" << std::endl;} };
template<class B> class Class<A1, B, true> { public: void hello() {std::cout << "First" << std::endl;} };
template<class A> class Class<A, B1, false> { public: void hello() {std::cout << "Second" << std::endl;} };
int main()
{
Class<A1,B1> obj;// The first one is picked up
obj.hello();
Class<A,B1> obj2; // The second one is picked up
obj2.hello();
Class<A,B> obj3; // Base
obj3.hello();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgQSB7fTsKY2xhc3MgQiB7fTsKY2xhc3MgQTEge307CmNsYXNzIEIxIHt9OwoKdGVtcGxhdGU8Y2xhc3MgQSwgY2xhc3MgQiwgYm9vbCBBaXNBMSA9IHN0ZDo6aXNfc2FtZTxBLEExPjo6dmFsdWU+CmNsYXNzIENsYXNzIHsgcHVibGljOiB2b2lkIGhlbGxvKCkge3N0ZDo6Y291dCA8PCAiQmFzZSIgPDwgc3RkOjplbmRsO30gfTsKCnRlbXBsYXRlPGNsYXNzIEI+IGNsYXNzIENsYXNzPEExLCBCLCB0cnVlPiB7IHB1YmxpYzogdm9pZCBoZWxsbygpIHtzdGQ6OmNvdXQgPDwgIkZpcnN0IiA8PCBzdGQ6OmVuZGw7fSB9Owp0ZW1wbGF0ZTxjbGFzcyBBPiBjbGFzcyBDbGFzczxBLCBCMSwgZmFsc2U+IHsgcHVibGljOiB2b2lkIGhlbGxvKCkge3N0ZDo6Y291dCA8PCAiU2Vjb25kIiA8PCBzdGQ6OmVuZGw7fSB9OwoKaW50IG1haW4oKQp7CiAgICAKICBDbGFzczxBMSxCMT4gb2JqOy8vIFRoZSBmaXJzdCBvbmUgaXMgcGlja2VkIHVwCiAgb2JqLmhlbGxvKCk7CiAgQ2xhc3M8QSxCMT4gb2JqMjsgLy8gVGhlIHNlY29uZCBvbmUgaXMgcGlja2VkIHVwCiAgb2JqMi5oZWxsbygpOwogIENsYXNzPEEsQj4gb2JqMzsgLy8gQmFzZQogIG9iajMuaGVsbG8oKTsKICAKICByZXR1cm4gMDsKfQ==