首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

vc2005支持 template template 参数吗?该怎么解决

2012-02-12 
vc2005支持 template template 参数吗?最近在看《C++设计新思维》遇到这个问题。我写程序时了一下,好像不支持

vc2005支持 template template 参数吗?
最近在看《C++   设计新思维》遇到这个问题。
我写程序时了一下,好像不支持啊

[解决办法]
如下程序就可以编译运行:

template < template <typename T> class W >
class TheClass
{
public:
int fun() { return sizeof(W <int> ); };
};

template <typename A>
class Widget
{
int arr[10];
};

#include <vector>
int main()
{
TheClass < Widget > tc;

return tc.fun();

}

热点排行