C++ covariant templates
问题 I feel like this one has been asked before, but I'm unable to find it on SO, nor can I find anything useful on Google. Maybe "covariant" isn't the word I'm looking for, but this concept is very similar to covariant return types on functions, so I think it's probably correct. Here's what I want to do and it gives me a compiler error: class Base; class Derived : public Base; SmartPtr<Derived> d = new Derived; SmartPtr<Base> b = d; // compiler error Assume those classes are fully fleshed out...