The following code example is taken from the book
C++20 - The Complete Guide
by Nicolai M. Josuttis,
Leanpub, 2021
The code is licensed under a
Creative Commons Attribution 4.0 International License.
// raw code
#include "coord.hpp"
#include <iostream>
#include <algorithm>
int main()
{
std::vector<Coord> coll{ {0, 5, 5}, {5, 0, 0}, {3, 5, 5},
{3, 0, 0}, {3, 5, 7} };
std::sort(coll.begin(), coll.end());
for (const auto& elem : coll) {
std::cout << elem.x << '/' << elem.y << '/' << elem.z << '\n';
}
}