C++ - static_pointer_cast

less than 1 minute read

C++11 introduce the static_pointer_cast which will allow to case the shared_ptr to another type without runtime checking.

  • static_pointer_cast
    Casts a shared_ptr to a different type without checking the type at runtime.

  • dynamic_pointer_cast

Casts a shared_ptr to a different type and checks the type at runtime. If the cast fails, return a null pointer.

Categories:

Updated: