std::sort(vec.begin(), vec.end(), [] (const auto& lhs, const auto& rhs) { return lhs.whatever < rhs.whatever; });
auto sort_by_whatever = [] (const auto& lhs, const auto& rhs) { return lhs.whatever < rhs.whatever; }; std::sort(vec.begin(), vec.end(), sort_by_whatever);