#include <iostream>
#include <vector>
using namespace std;
template<class Iter>
void insertSort(const Iter begin, const Iter end) {
for (auto i = begin+1; i != end; i++) {
auto temp = *i;
auto j = i - 1;
while ((j >= begin) && (temp < *j)) {
*(j+1) = *j;
j--;
}
*(j + 1) = temp;
}
}
int main() {
vector<int> arr{ 1,222,55,6,453,45,544,12 };
insertSort(arr.begin(), arr.end());
for (auto i = arr.begin(); i != arr.end(); i++) {
cout << *i << " ";
}
cout << endl;
system("pause");
return 0;
}