Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- auto sortBy(alias get, alias predicate = less, Range)(Range range) {
- static if (is(typeof(get) == string)) {
- static auto getFunc(T)(T _) {
- return mixin(get);
- }
- } else {
- alias get getFunc;
- }
- return range.sort!((x, y) => (predicate(getFunc(x), getFunc(y))));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement