#include <iostream>
#include <algorithm>
#include <vector>


std::vector<int> &selection_sort (std::vector<int> &v)
{
	for (auto it = v.begin(); it != v.end() - 1; ++it)
	{
		auto smallest = std::min_element (it + 1, v.end());
		std::cout << "it = " << *it << std::endl;
		std::cout << "(it + 1) = " << *(it + 1) << std::endl;
		std::cout << "smallest = " << *smallest << std::endl;
		std::iter_swap (it, smallest);
	}
	return v;
}

int main()
{
	std::vector<int> v = {8, 2, 3, 4, 7, 1, 5, 9, 6, 10};
	v = selection_sort (v);
	for (auto &i : v)
		std::cout << i << " ";
	std::cout << std::endl;
}