is_sorted example template void slow_sort(It begin, It end) { while (!is_sorted(begin, end)) random_shuffle(begin, end); } int main() { int a[ ] = {1, 2, 3, 5, 4}; const int N = 5; slow_sort(a, a + N); copy(a, a + N, ostream_iterator(cout, " ")); }