c++基础[..ing]
时间:2010-12-21 来源:LeeCe
pair, map, set, multimap, multiset:
pair
create:
pair<type, type> var(param, param) ; 3
pair<type, type> var = make_pair(param, param);
pair<type, type> var = pair<type, type>(param, param);
use:
var.first var.second
map
member:
::key_type; key
::mapped_type; value
::value_type; pair
::iterator
insert:
var[key] = xx;
var.insert(pair); 3
search:
var.find() iterator
var.count() num=1?0
delete:
var.erase()
set
same as map except:
insert:
no var[key] = xx;
member:
no ::value_type;
::mapped_type == ::key_type;
multimap
same as map except:
delete:
var.erase(search_item);
search:3
sz_type num= authors.count(search_item);
m.equal_range(pair<authors_it, authors_it>);