【发布时间】:2014-06-17 22:05:18
【问题描述】:
我想知道是否可以使用 typedef'd 容器作为模板参数。我正在尝试以下方法:
template<typename T>
using containerT = std::vector<T>;
template <template<class T, class = std::allocator<T> > class container_type = containerT >
struct nodeData {
container_type<int> param;
};
int main()
{
nodeData<> nd;
}
这会导致 GCC 4.8 出现编译错误:
需要一个类型为“模板类”的模板 container_type', 得到'模板使用 containerT = std::vector
'
有人知道怎么做吗?
谢谢
【问题讨论】: