这是我正在使用的数据类型。如何循环两对STL集<pair<t1,t2>,对<t1,t2>>中的所有元素?
set< std::pair<string,string>,std::pair<string,string>> foo;
这是我在超过它的循环
for(auto &e: foo){
cout << e.first << " " << e.second // this is where I am having an issue.
}
是否有可能使用自动这种方式失败的尝试? e.g
e.first, e.second // some c++ magic (i realize -> is wrong) In pseudo -> // e.third ...
我喜欢使用汽车,但如果不是我会怎么写我使用的数据类型的迭代器?
但你*的*已经循环虽然集。问题是,在你的循环中,“e.first”是*** ***对***,“e.second”是数据***对***。 –
从什么时候'std :: set'有键和值?你是不是指'map'而不是'set'? – Rumburak