#include <array>
#include <iostream>
#include <algorithm>
struct S {
int n;
};
template <size_t N>
void printArray(const std::array<S, N>& arr) {
for (auto s: arr) {
std::cout << s.n << " ";
}
std::cout << std::endl;
}
int main(void) {
std::array<S, 10> arr {{ {1}, {7}, {8}, {3}, {5}, {9}, {4}, {2}, {6}, {10} }};
printArray(arr);
std::sort(arr.begin(), arr.end(), [](const S& a, const S& b) {
return a.n < b.n;
});
printArray(arr);
return 0;
}