标签:str pre 其他 word 选择 分配 value 重复 内存
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
template < typename T> void removeDuplicates(list<T> &aList) { T curValue; list<T>::iterator cur, p; cur = aList.begin(); while (cur != aList.end()) { curValue = *cur; //空白行 while (p != aList.end()) { if (*p == curValue) { //空白行 } else { p++; } } } } |
p=curr+1;aList.erase(p++);
p=++curr;aList.erase(p++);
p=curr+1;aList.erase(p);
p=++curr;aList.erase(p);
答案:B 错选:D
1
2
3
4
5
6
7
8
9
10
|
//vector<int> m_vector; for (vector< int >::iterator iter = m_vector.begin(); iter != m_vector.end();) { if (需要删除) { iter=m_vector.erase(iter); } else ++iter; } |
1
2
3
4
5
6
7
8
9
10
|
//map<int,int> m_map; for (map< int , int >::iterator iter = m_map.begin(); iter != m_map.end(); ) { if (需要删除) { m_map.erase(iter++); } else ++iter; } |
标签:str pre 其他 word 选择 分配 value 重复 内存
原文地址:https://www.cnblogs.com/kxzh/p/9107557.html