#include <type_traits>
#include <iostream>
class MyClass
{
};
template <typename Object>
class List
{
public:
template<class T=Object>
void insert(T t, typename std::enable_if<std::is_pointer<T>::value >::type* = 0)
{
std::cout << "insert pointer" << std::endl;
}
template<class T=Object>
void insert(T t, typename std::enable_if<!std::is_pointer<T>::value >::type* = 0)
{
std::cout << "insert non-pointer" << std::endl;
}
};
int main()
{
MyClass a;
List<MyClass> lst;
List<MyClass*> plst;
lst.insert(a);
plst.insert(new MyClass());
return 0;
}
CSNpbmNsdWRlIDx0eXBlX3RyYWl0cz4KCSNpbmNsdWRlIDxpb3N0cmVhbT4KCWNsYXNzIE15Q2xhc3MKCXsKCX07CgkKCXRlbXBsYXRlIDx0eXBlbmFtZSBPYmplY3Q+CgljbGFzcyBMaXN0Cgl7CglwdWJsaWM6CgkKCQl0ZW1wbGF0ZTxjbGFzcyBUPU9iamVjdD4KCQl2b2lkIGluc2VydChUIHQsIHR5cGVuYW1lIHN0ZDo6ZW5hYmxlX2lmPHN0ZDo6aXNfcG9pbnRlcjxUPjo6dmFsdWUgPjo6dHlwZSogPSAwKSAKCQl7CgkJICAgIHN0ZDo6Y291dCA8PCAiaW5zZXJ0IHBvaW50ZXIiIDw8IHN0ZDo6ZW5kbDsKCQl9CgkJCgkJdGVtcGxhdGU8Y2xhc3MgVD1PYmplY3Q+CgkJdm9pZCBpbnNlcnQoVCB0LCB0eXBlbmFtZSBzdGQ6OmVuYWJsZV9pZjwhc3RkOjppc19wb2ludGVyPFQ+Ojp2YWx1ZSA+Ojp0eXBlKiA9IDApIAoJCXsKCQkgICAgc3RkOjpjb3V0IDw8ICJpbnNlcnQgbm9uLXBvaW50ZXIiIDw8IHN0ZDo6ZW5kbDsKCQl9Cgl9OwoJCglpbnQgbWFpbigpCgl7CgkgICAgTXlDbGFzcyBhOwoJCgkgICAgTGlzdDxNeUNsYXNzPiBsc3Q7CgkgICAgTGlzdDxNeUNsYXNzKj4gcGxzdDsKCQoJICAgIGxzdC5pbnNlcnQoYSk7CgkgICAgcGxzdC5pbnNlcnQobmV3IE15Q2xhc3MoKSk7CgkKCSAgICByZXR1cm4gMDsKCX0=