summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/sorting.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sorting.h b/lib/sorting.h
index 777de00..be5a7e2 100644
--- a/lib/sorting.h
+++ b/lib/sorting.h
@@ -1,5 +1,6 @@
#pragma once
+#include <functional>
#include <glm/fwd.hpp>
#include <type_traits>
@@ -30,6 +31,14 @@ template<typename T, auto M> struct PtrMemberSorter : public PtrSorter<T> {
}
};
+template<auto Proj> struct SortedBy {
+ auto
+ operator()(const auto & left, const auto & right) const
+ {
+ return (std::invoke(Proj, left) < std::invoke(Proj, right));
+ }
+};
+
struct CompareBy {
glm::length_t index;