简体   繁体   English

如何创建包含字符串作为键值并指向链表的无序映射?

[英]How can I create an unordered map containing a string as key value and pointing to a linked list?

Is there a way I can create a unordered_map such that it is something like, 有没有办法我可以创建一个unordered_map这样的东西,

unordered_map<string,linkedlist>

Basically, I will be inputting the key value, and if any string (its sorted value) equals the already stored key value, then I will insert that string in the linkedlist for that sorted value. 基本上,我将输入键值,并且如果任何字符串(其排序后的值)等于已存储的键值,则将该字符串插入该排序后的值的链表中。 How do I declare such an unordered_map? 如何声明这样的unordered_map?

std::unordered_map<std::string, std::list<std::string> > data;

尽管我很难理解您到底要完成什么...我不确定是否需要链表列表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM