又个新手被打击了。
回复 20楼 wxjeacen
我找了好久都没找着,却发现你的许多废话~~我看你顶多也是个菜鸟,就会胡吹~
#include<iostream> #include<ext/rb_tree> using namespace __gnu_cxx; using namespace std; class cmp{ public: bool operator()(int a,int b){ return a<b; } }; class Key{ public: int operator()(int a){ return a; } }; int main() { rb_tree<int,int,Key,cmp> tree; for(int i=0;i<10;i++){ int n=rand()%100; tree._M_insert_unique(n); } for(rb_tree<int,int,Key,cmp>::iterator iter=tree.begin();iter!=tree.end();++iter){ cout<<*iter<<endl; } return 0; }