【发布时间】:2012-08-15 15:18:06
【问题描述】:
我正在尝试使用 ptr_vector 来存储一些指针,但我在使用 main 方法时立即收到错误消息。 这是我的代码:
int main(void)
{
boost::ptr_vector<string> temp;
string s1 = "hi";
string s2 = "hello";
temp.push_back(&s1);
temp.push_back(&s2);
return 0;
}
这是我收到的错误消息:
Critical error detected c0000374
Windows has triggered a breakpoint in Path_Tree.exe.
This may be due to a corruption of the heap, which indicates a bug in Path_Tree.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while Path_Tree.exe has focus.
The output window may have more diagnostic information.
The program '[7344] Path_Tree.exe: Native' has exited with code 0 (0x0).
我做错了什么? 谢谢!
【问题讨论】:
标签: c++ boost ptr-vector boost-ptr-container