| Home | Libraries | People | FAQ | More

## `polymorphic_cast`, `polymorphic_downcast`, `polymorphic_pointer_cast` and `polymorphic_pointer_downcast` synopsis

    namespace boost {

    template <class Derived, class Base>
    inline Derived polymorphic_cast(Base* x);
    // Throws: std::bad_cast if ( dynamic_cast<Derived>(x) == 0 )
    // Returns: dynamic_cast<Derived>(x)

    template <class Derived, class Base>
    inline Derived polymorphic_downcast(Base* x);
    // Effects: assert( dynamic_cast<Derived>(x) == x );
    // Returns: static_cast<Derived>(x)

    template <class Derived, class Base>
    inline auto polymorphic_pointer_cast(Base x);
    // Throws: std::bad_cast if ( dynamic_pointer_cast<Derived>(x) == 0 )
    // Returns: dynamic_pointer_cast<Derived>(x)

    template <class Derived, class Base>
    inline auto polymorphic_pointer_downcast(Base x);
    // Effects: assert( dynamic_pointer_cast<Derived>(x) == x );
    // Returns: static_pointer_cast<Derived>(x)

    }