C++ 无法从 typedef 或 typedef 模板类中生成模板。我知道如果我继承并使我的类成为模板,它将起作用。
例子:
// Illegal
template <class T>
typedef MyVectorType vector<T>;
//Valid, but advantageous?
template <class T>
class MyVectorType : public vector<T> { };
这样做是有利的,以便我可以“伪造” typedef 还是有更好的方法来做到这一点?