随笔分类 -  stl

指针做MAP的KEY的TEST
摘要:用struct做map的key会需要"operator #include #include using namespace std;//////////////////////////////////////////////////////////////////////////struct s{ int x; int y;};void main(){ map m; s* a = new s; a->x = 1; a->y = 2; s* b = new s; b->x = 1; b->y = 2; m.insert(pair(a, ... 阅读全文

posted @ 2013-10-10 03:30 shizuka 阅读(290) 评论(0) 推荐(0)

new_look_on_vector
摘要:没看过什么深入理解STL什么的,暂时也没想看类似的东西。不过因为偶尔会有误用到vector.end()的时候,而且很烦躁,所以突然有了个想法。弄了下面的,试了下效果。void main(){ int i; vector<int*> vec; int j = 1; vec.push_back(&j); vec.push_back(&j); vec.push_back(&j); cout<<"&vec.begin:\t"<<&(vec.begin())<<endl; cout<< 阅读全文

posted @ 2012-02-03 16:33 shizuka 阅读(217) 评论(0) 推荐(0)

导航