#pragma once #include namespace gp { template void selection_sort(it_t first, it_t last, pred predicate = pred{}) { while(first != last) { auto traveler = first; auto it = first; it++; for(;it!=last;it++) { if(predicate(*it, *traveler)) traveler = it; } gp::swap(*first, *traveler); first++; } } template void sort(it_t first, it_t last, pred predicate = pred{}) { return selection_sort(first, last, predicate); } }