Q模板结构列表
考虑以下两个结构:
template <typename T> struct duplet{
QString str;
T value;
}
struct MyObject{
QList<struct duplet> myList;
}
编译器抛出以下错误:
error C3203: 'Duplet' : unspecialized class template can't be used as a template argument for template argument 'T', Expected a real type
我是语法错误吗偶然发现或非法声明?
谢谢, 德科斯托
Consider the following two structures:
template <typename T> struct duplet{
QString str;
T value;
}
struct MyObject{
QList<struct duplet> myList;
}
The compiler throws the following error:
error C3203: 'Duplet' : unspecialized class template can't be used as a template argument for template parameter 'T', expected a real type
Is it syntax error that I am stumbling upon or a an illegal declaration ??
Thanks,
de costo
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这只是 duplet 作为模板,必须完全指定才能充当模板参数?编译器无法创建 mylist 实例,因为它不知道它是什么类型。 “duplet”不是(完整)类型; '二元组< T>对于某些类型 T' 来说。
并
编译对我来说很好。
I think its simply that duplet, as a template, must be fully specified in order to serve as a template argument? The compiler can't create the mylist instance because it doesn't know what type it is. 'duplet' is not a (complete) type; 'duplet< T > for some type T' is.
and
compile just fine for me.