#ifndef SORTERH #define SORTERH #include //for iterator_traits using namespace std; /* ITERATOR must be a random access iterator. The data type of the values to which it refers, typename iterator_traits::value_type, must be copy constructable, assignable, and strict weakly comparable. */ template void sorter(ITERATOR first, ITERATOR last) { while (first < --last) { for (ITERATOR it = first; it < last; ++it) { if (it[1] < it[0]) { const typename iterator_traits::value_type temp = it[0]; it[0] = it[1]; it[1] = temp; } } } } #endif