typedef std容器? [英] typedef std containers?

查看:157
本文介绍了typedef std容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做

typedef deque type; //error, use of class template requires template argument list
type<int> container_;

但是这个错误阻止了我。

But that error is preventing me. How do I do this?

推荐答案

你不能(直到C ++ 0x)。但它可以用下面的模拟:

You can't (until C++0x). But it could be emulated with:

template<typename T>
struct ContainerOf
{
  typedef std::deque<T> type;
};

用作:

ContainerOf<int>::type container_;

这篇关于typedef std容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆