定义了一个 std::list,但在迭代器上出现错误
defined a std::list but get error on iterator
我已经定义了一个std::list
但我不知道为什么我不能使用迭代器
#include <iostream>
#include <list>
using namespace std;
class foo {
public:
static const int N = 10;
list<int *> myList[ N ];
void bar()
{
list<int *>::iterator it = myList.begin(); //ERROR
}
};
int main()
{
foo a;
a.bar();
return 0;
}
因为你有一个列表数组,而不是一个列表。不该
list<int *> myList[N];
真的是
list<int *> myList;
?
相关文章:
- 初始化迭代器错误 C++ 在 GCC 编译器中
- 赛松迭代器错误
- C++ 迭代器错误"does not refer to a value"
- C 功能具有参考参数错误的迭代器错误.寻求解释
- 在 GCC 上自动声明映射迭代器错误
- 指针向量的迭代器错误预期;
- 获取迭代器错误的位置
- std::map<>::迭代器错误
- 迭代器错误从非标量类型转换为非标量类型
- 从 const char* 到迭代器错误的"无已知转换" - 另一个例子
- 类分配上的映射迭代器错误
- C++矢量迭代器错误
- C++ std::vector 迭代器错误
- stl 列表迭代器错误
- 列表迭代器错误c++
- C++ 迭代器错误
- 向量迭代器错误
- 迭代器错误C2440
- 列表的迭代器错误
- 迭代器中的矢量迭代器错误