• Jason Rhinelander's avatar
    Use dynamic cast for shared_from_this holder init · b8ac4383
    Jason Rhinelander authored
    Using a dynamic_cast instead of a static_cast is needed to safely cast
    from a base to a derived type.  The previous static_pointer_cast isn't
    safe, however, when downcasting (and fails to compile when downcasting
    with virtual inheritance).
    
    Switching this to always use a dynamic_pointer_cast shouldn't incur any
    additional overhead when a static_pointer_cast is safe (i.e. when
    upcasting, or self-casting): compilers don't need RTTI checks in those
    cases.
    b8ac4383
test_smart_ptr.cpp 10.3 KB