Руководство по стандартной библиотеке шаблонов STL

       

int main


#include <iostream.h> #include <stl.h>

int main () { set<int, less<int> > s; cout << "count (42) = " << s.count (42) << endl; s.insert (42); cout << "count (42) = " << s.count (42) << endl; s.insert (42); cout << "count (42) = " << s.count (42) << endl; int count = s.erase (42); cout << count << " elements erased" << endl; return 0; }



#include <iostream.h> #include <stl.h>

int main () { set<int, less<int> > s; pair<set<int, less<int> >::const_iterator, bool> p; p = s.insert (42); if (p.second) cout << " Inserted new element " << *(p.first) << endl; else cout << "Existing element = " << *(p.first) << endl; p = s.insert (42); if (p.second) cout << "Inserted new element " << *(p.first) << endl; else cout << "Existing element = " << *(p.first) << endl; return 0; }


Содержание раздела