The class reference type should be fixable with a rewrite into templated smart pointers, so no need for big changes there, I think.
Smart pointers impose a specific object lifetime, whereas (D) classes do not. You cannot lower (D) class instances to smart pointers.
