【发布时间】:2016-02-02 06:03:10
【问题描述】:
尽管我花费了不合理的时间,但我有一个无法解决的问题。我想要一个列表 >,但它不起作用。这是我的代码:
int main(int argc, const char * argv[]) {
int a=2;
int b=3;
list<list<int*>> test;
list< list<int*> >::iterator it;
it = test.begin();
it->push_back(&a);
it->push_back(&b);
b=4; //should modify the content of "test"
for(list <int*>::iterator it2 = it->begin(); it2 != it->end(); it2++) {
cout << *it2 << endl;
}
}
使用 xCode 可以编译,但出现“线程 1:EXC_BAD_ACCESS”错误。希望大家多多指教!
谢谢!
【问题讨论】: