我在我的程序中使用这样的向量:
vector<vector<string> > values;
values[0].push_back("test words");
当我运行代码时,它显示“段错误”
然后我尝试gdb它,我得到了这个:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000008
0x00000001000035be in std::vector<std::string, std::allocator<std::string> >::push_back (this=0x0, __x=@0x7fff5fbff330) at stl_vector.h:602
602 if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
这里发生了什么 ?