【发布时间】:2018-12-04 06:49:25
【问题描述】:
我正在尝试制作一个包含矢量的地图,但在尝试访问元素时出现错误。
这是我的代码:
#include <iostream>
#include <map>
#include <vector>
#include <string>
using namespace std;
int main()
{
map<int, vector<vector<string>>> m;
m[0][0].push_back("hi");
return 0;
}
你可以在这里试试:https://onlinegdb.com/HytLmjQJV
我得到的错误是在 Visual Studio 中:
调试断言失败。程序:表达式:向量下标超出范围。
【问题讨论】:
-
欢迎来到 Stack Overflow。请阅读the help pages,尤其是"What topics can I ask about here?" 和"What types of questions should I avoid asking?"。还有take the tour 和read about how to ask good questions 和this question checklist。最后,请告诉我们错误(复制粘贴到问题本身)。
-
@Someprogrammerdude 编辑了我的问题。希望越来越好。
标签: c++ dictionary vector