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


Eqlrnge2


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

char chars[] = "aabbccddggghhklllmqqqqssyyzz";

int main () { const unsigned count = sizeof (chars) - 1; ostream_iterator<char> iter (cout); cout << "Within the collection:\n\t"; copy (chars, chars + count, iter); pair <char*, char*> range; range = equal_range (chars, chars + count, 'q', less<char>()); cout << "\nq can be inserted from before index " << (range.first - chars) << " to before index " << (range.second - chars) << endl; return 0; }




Начало  Назад  Вперед



Книжный магазин