/data/codesdev/testdemo/c++/map/stl_map.cpp
make stl_map
g++ stl_map.cpp -o stl_map
./stl_map
Bill, A senior heigh school student.
Join, A senior heigh school student.
Marry, A senior heigh school teacher.
/data/codesdev/testdemo/c++/map/stl_map_find.cpp
make stl_map_find
g++ stl_map_find.cpp -o stl_map_find
./stl_map_find
elements in mymap:
a => 50
c => 150
d => 200
b => 0
e => 0
修改那个位置判断为:
[codes=php]
it = mymap.find('d');
if (it != mymap.end()) #if (iter == g_map_fd_TcpNLMsg.end())假如到最扣一个依然没有找到的意思。一般就直接返回。
mymap.erase (it);
[/php]
这样的结果:
./stl_map_find
elements in mymap:
a => 50
c => 150
d => 0
b => 100
e => 0
来自:http://blog.csdn.net/derkampf/article/details/71155055
make stl_map
g++ stl_map.cpp -o stl_map
./stl_map
Bill, A senior heigh school student.
Join, A senior heigh school student.
Marry, A senior heigh school teacher.
/data/codesdev/testdemo/c++/map/stl_map_find.cpp
make stl_map_find
g++ stl_map_find.cpp -o stl_map_find
./stl_map_find
elements in mymap:
a => 50
c => 150
d => 200
b => 0
e => 0
修改那个位置判断为:
[codes=php]
it = mymap.find('d');
if (it != mymap.end()) #if (iter == g_map_fd_TcpNLMsg.end())假如到最扣一个依然没有找到的意思。一般就直接返回。
mymap.erase (it);
[/php]
这样的结果:
./stl_map_find
elements in mymap:
a => 50
c => 150
d => 0
b => 100
e => 0
来自:http://blog.csdn.net/derkampf/article/details/71155055
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/9584/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2018-1-1 16:22
评论列表