Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试试
template<class T> struct getData { boost::shared_ptr<T> operator()() { return boost::shared_ptr<T>(new T()); } }; struct getVector : public getData<std::vector<int>>{};
我想()通过继承指定返回......但它似乎没有返回所需的类型。我做错了什么?
()
您不需要返回类型吗
boost::shared_ptr<T> operator()() ^^^^^^^^^^^^^^^^^^^^ { return boost::shared_ptr<T>(new T()); }