Casting pointer to pointer in a type-safe manner

Viewed 117

Given the following piece of code:

class Base
{
public:
   virtual ~Base() = default;
};

class Derived : public Base { };

int main(void)
{
  Derived d;
  Base* pb = &d;
  Base** ppb = &pb;

  Derived** ppd = ...; // Can this be defined in a type-safe manner?

  return 0;
}

Is it possible to give a type-safe expression for the assignment to ppd, without introducing an intermediary variable of type Derived*?

2 Answers
Related