diff --git a/lib/utils/include/utils/containers.h b/lib/utils/include/utils/containers.h index 06c297f35d..fd00745a4b 100644 --- a/lib/utils/include/utils/containers.h +++ b/lib/utils/include/utils/containers.h @@ -518,12 +518,9 @@ std::vector sorted_by(std::unordered_set const &s, F const &f) { template void inplace_sorted_by(std::vector &v, F const &f) { - struct { - bool operator()(T const &lhs, T const &rhs) { - return f(lhs, rhs); - } - } custom_comparator; - + auto custom_comparator = [&](T const &lhs, T const &rhs) -> bool { + return f(lhs, rhs); + }; std::sort(v.begin(), v.end(), custom_comparator); }