我想做的是
typedef deque type; //error, use of class template requires template argument list
type<int> container_;但是这个错误阻止了我。我该怎么做呢?
发布于 2009-02-18 18:28:15
你不能(直到C++0x)。但可以通过以下方式进行模拟:
template<typename T>
struct ContainerOf
{
typedef std::deque<T> type;
};用作:
ContainerOf<int>::type container_;发布于 2009-02-18 18:14:24
deque不是一种类型。它是一个模板,用于在给定参数时生成类型。
deque<int> 是一种类型,所以你可以这样做
typedef deque<int> container_发布于 2009-02-18 18:11:42
你不需要,C++还不支持这种类型定义。你当然可以说;
typedef std::deque <int> IntDeque;https://stackoverflow.com/questions/562209
复制相似问题