您在 C++ 中的类型的向量

覆盆子

我在 StackOverflow 和 Google 上搜索了很多主题,但我不明白我做错了什么。

template<class T>
class E {
    T data;
};
int main() {
    vector<E> vector1;
    return 0;
}

它返回构建错误:

error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
     vector<E> vector1;
覆盆子

知道了。

int main() {
    vector<E<int>> vector1;
    return 0;
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章