#include <memory>
class Base{};
class Derived : public Base {};
class ExtraDerived : public Derived {};
bool IsBase(Base*){ return true; }
bool IsBase(Derived*){ return false; }
bool IsBase(std::shared_ptr<Base>){ return true; }
bool IsBase(std::shared_ptr<Derived>){ return false; }
int main()
{
auto derived = std::make_shared<Derived>();
auto extra_derived = std::make_shared<ExtraDerived>();
// works
auto raw_result_derived = IsBase(derived.get());
auto raw_result_extra_derived = IsBase(extra_derived.get());
auto shared_result_derived = IsBase(derived);
// doesn't work
auto shared_result_extra_derived = IsBase(extra_derived);
}
I2luY2x1ZGUgPG1lbW9yeT4KCmNsYXNzIEJhc2V7fTsKY2xhc3MgRGVyaXZlZCA6IHB1YmxpYyBCYXNlIHt9OwpjbGFzcyBFeHRyYURlcml2ZWQgOiBwdWJsaWMgRGVyaXZlZCB7fTsKCgpib29sIElzQmFzZShCYXNlKil7IHJldHVybiB0cnVlOyB9CmJvb2wgSXNCYXNlKERlcml2ZWQqKXsgcmV0dXJuIGZhbHNlOyB9Cgpib29sIElzQmFzZShzdGQ6OnNoYXJlZF9wdHI8QmFzZT4peyByZXR1cm4gdHJ1ZTsgfQpib29sIElzQmFzZShzdGQ6OnNoYXJlZF9wdHI8RGVyaXZlZD4peyByZXR1cm4gZmFsc2U7IH0KCmludCBtYWluKCkgCnsKICAgIGF1dG8gZGVyaXZlZCA9IHN0ZDo6bWFrZV9zaGFyZWQ8RGVyaXZlZD4oKTsKICAgIGF1dG8gZXh0cmFfZGVyaXZlZCA9IHN0ZDo6bWFrZV9zaGFyZWQ8RXh0cmFEZXJpdmVkPigpOwogICAgLy8gd29ya3MKICAgIGF1dG8gcmF3X3Jlc3VsdF9kZXJpdmVkID0gSXNCYXNlKGRlcml2ZWQuZ2V0KCkpOwogICAgYXV0byByYXdfcmVzdWx0X2V4dHJhX2Rlcml2ZWQgPSBJc0Jhc2UoZXh0cmFfZGVyaXZlZC5nZXQoKSk7CiAgICBhdXRvIHNoYXJlZF9yZXN1bHRfZGVyaXZlZCA9IElzQmFzZShkZXJpdmVkKTsKICAgIC8vIGRvZXNuJ3Qgd29yawogICAgYXV0byBzaGFyZWRfcmVzdWx0X2V4dHJhX2Rlcml2ZWQgPSBJc0Jhc2UoZXh0cmFfZGVyaXZlZCk7Cn0=