#include <iostream>
#include <type_traits>
struct Printable {};
struct Serializable {};
struct DerivedPrintable : Printable {};
struct DerivedSerializable : Serializable {};
template <class T, typename std::enable_if<std::is_base_of<Printable, T>::value>::type* = nullptr>
void print(const T& value) {
std::cout << "printable(" << &value << ")\n";
}
template <class T, typename std::enable_if<std::is_base_of<Serializable, T>::value>::type* = nullptr>
void print(const T& value) {
std::cout << "serializable(" << &value << ")\n";
}
int main() {
print(Printable());
print(DerivedPrintable());
print(Serializable());
print(DerivedSerializable());
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dHlwZV90cmFpdHM+CiAKc3RydWN0IFByaW50YWJsZSB7fTsKc3RydWN0IFNlcmlhbGl6YWJsZSB7fTsKc3RydWN0IERlcml2ZWRQcmludGFibGUgOiBQcmludGFibGUge307CnN0cnVjdCBEZXJpdmVkU2VyaWFsaXphYmxlIDogU2VyaWFsaXphYmxlIHt9OwogCnRlbXBsYXRlIDxjbGFzcyBULCB0eXBlbmFtZSBzdGQ6OmVuYWJsZV9pZjxzdGQ6OmlzX2Jhc2Vfb2Y8UHJpbnRhYmxlLCBUPjo6dmFsdWU+Ojp0eXBlKiA9IG51bGxwdHI+CnZvaWQgcHJpbnQoY29uc3QgVCYgdmFsdWUpIHsKICAgIHN0ZDo6Y291dCA8PCAicHJpbnRhYmxlKCIgPDwgJnZhbHVlIDw8ICIpXG4iOwp9Cgp0ZW1wbGF0ZSA8Y2xhc3MgVCwgdHlwZW5hbWUgc3RkOjplbmFibGVfaWY8c3RkOjppc19iYXNlX29mPFNlcmlhbGl6YWJsZSwgVD46OnZhbHVlPjo6dHlwZSogPSBudWxscHRyPgp2b2lkIHByaW50KGNvbnN0IFQmIHZhbHVlKSB7CiAgICBzdGQ6OmNvdXQgPDwgInNlcmlhbGl6YWJsZSgiIDw8ICZ2YWx1ZSA8PCAiKVxuIjsKfSAKIAppbnQgbWFpbigpIHsKICAgIHByaW50KFByaW50YWJsZSgpKTsKICAgIHByaW50KERlcml2ZWRQcmludGFibGUoKSk7CiAgICBwcmludChTZXJpYWxpemFibGUoKSk7CiAgICBwcmludChEZXJpdmVkU2VyaWFsaXphYmxlKCkpOwp9Cg==