C++ 输出';它在一张无序的地图里
有人知道如何输出一个无序映射中的结构变量吗C++ 输出';它在一张无序的地图里,c++,struct,output,unordered,C++,Struct,Output,Unordered,有人知道如何输出一个无序映射中的结构变量吗 typedef struct dictionary{ std::string word; unsigned char hash[20]; std::string hex; } a_dictionary; typedef std::unordered_map<std::string, dictionary*> Mymap; std::unordered_map<std::string, dictionary* >:
typedef struct dictionary{
std::string word;
unsigned char hash[20];
std::string hex;
} a_dictionary;
typedef std::unordered_map<std::string, dictionary*> Mymap;
std::unordered_map<std::string, dictionary* >::const_iterator got = c1.find(line);
if(out.is_open())
{
if ( got == c1.end() )
{
out << "????";
}
else
{
out << got->first << " , ";
}
}
}
typedef结构字典{
字符串字;
无符号字符散列[20];
字符串十六进制;
}字典;
typedef std::无序映射Mymap;
std::无序映射::常量迭代器get=c1.find(行);
if(out.is_open())
{
if(get==c1.end())
{
out迭代器的第二个
成员是指向a_字典
结构的指针,因此只需像访问普通结构指针一样访问它:
out << got->first << " , " << got->second->word;
输出第一个单词;