我知道这是一个虚假的问题,我会得到很多弊端,但我知道这一点,所以无论如何我都会问......
我在地图上播下了下一个循环类型:
for(auto const& ent2 : ent1.second) {
// ent2.first is the second key
// ent2.second is the data
}
有了这个,我可以轻松地通过迭代器循环一个地图。 但我想知道我是否可以在其他类型的数据上使用这种循环,如字符串和向量等... 什么是这种循环的名称,所以我可以搜索它。