提问人:Desconocido 提问时间:6/4/2023 最后编辑:cigienDesconocido 更新时间:6/4/2023 访问量:43
如何声明无序映射和字符串向量的unordered_map?
How do i declare an unordered_map of an unordered map and a vector of strings?
问:
我正在尝试并得到以下代码
#include <unordered_map>
#include <vector>
#include <string>
using namespace std;
int main() {
unordered_map<char, int> myMap;
vector<string> myVector;
unordered_map<unordered_map<char, int>, vector<string>> myUnorderedMap;
myUnorderedMap[myMap] = myVector;
return 0;
}
我收到以下错误:
main.cpp: In function ‘int main()’:
main.cpp:9:61: error: use of deleted function ‘std::unordered_map\<\_Key, \_Tp, \_Hash, \_Pred, \_Alloc\>::unordered_map() \[with \_Key = std::unordered_map; \_Tp = std::vector \>; \_Hash = std::hash \>; \_Pred = std::equal_to \>; \_Alloc = std::allocator, std::vector \> \> \>\]’
9 | unordered_map\<unordered_map\<char, int\>, vector\<string\>\> myUnorderedMap;
| ^\~\~\~\~\~\~\~\~\~\~\~\~\~
In file included from /usr/include/c++/11/unordered_map:47,
from main.cpp:1:
我正在尝试在 c++ 中创建无序映射和字符串向量的unordered_map
类似的东西unordered_map<unordered_map<char, int>, vector<string>> myUnorderedMap;
答: 暂无答案
评论
unordered_map<char, int>
myUnorderedMap