d****p 发帖数: 685 | 1 不是坑,只是我自己的观察
见到如下code:
1 #include
2 #include
3 #include
4
5 typedef std::pair Property;
6
7 int main()
8 {
9 std::vector properties;
10 properties.push_back(std::make_pair("name", "foo"));
11 properties.push_back(std::make_pair("hobby", "coding"));
12 //...
13 for (std::vector::const_iterator pItr = properties.begin
();
14 pItr != properties.end(); ++pItr)
15 | c*******9 发帖数: 6411 | 2 pItr is changing in the loop, could you use
const std::string& id = pItr->first; |
|