#include <iostream>
class MyClass
{
};
template <typename Object>
class List
{
public:
template<class C = Object>
void insert(const C & x)
{
// call when Object is MyClass
std::cout << "1" << "\n" ;
}
template<class P = Object*>
void insert(P* p)
{
// call when Object is MyClass*
std::cout << "2" << "\n" ;
}
} ;
int main()
{
MyClass a;
List<MyClass> lst;
List<MyClass*> plst;
lst.insert(a);
plst.insert(new MyClass);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgogCmNsYXNzIE15Q2xhc3MKewogCn07CiAKdGVtcGxhdGUgPHR5cGVuYW1lIE9iamVjdD4KY2xhc3MgTGlzdAp7CnB1YmxpYzoKIAogICAgdGVtcGxhdGU8Y2xhc3MgQyA9IE9iamVjdD4KICAgIHZvaWQgaW5zZXJ0KGNvbnN0IEMgJiB4KQogICAgewogICAgICAgIC8vIGNhbGwgd2hlbiBPYmplY3QgaXMgTXlDbGFzcwogICAgCXN0ZDo6Y291dCA8PCAiMSIgPDwgIlxuIiA7CiAgICB9CiAKICAgIHRlbXBsYXRlPGNsYXNzIFAgPSBPYmplY3QqPgogICAgICAgdm9pZCBpbnNlcnQoUCogcCkKICAgIHsKICAgICAgICAvLyBjYWxsIHdoZW4gT2JqZWN0IGlzIE15Q2xhc3MqCiAgICAJc3RkOjpjb3V0IDw8ICIyIiA8PCAiXG4iIDsKICAgIH0KfSA7CiAKaW50IG1haW4oKQp7CiAgICBNeUNsYXNzIGE7CiAKICAgIExpc3Q8TXlDbGFzcz4gbHN0OwogICAgTGlzdDxNeUNsYXNzKj4gcGxzdDsKIAogICAgbHN0Lmluc2VydChhKTsKICAgIHBsc3QuaW5zZXJ0KG5ldyBNeUNsYXNzKTsKIAogICAgcmV0dXJuIDA7Cn0=