sortOn: sorts range of aggregates by member name(s)
"Nordlöw" via Digitalmars-d
digitalmars-d at puremagic.com
Thu Nov 6 01:13:05 PST 2014
On Wednesday, 5 November 2014 at 21:29:20 UTC, Marc Schütz wrote:
> Again untested:
>
> private alias makePredicate(alias xtr) =
> (a, b) => (extractorFun!xtr(a) < extractorFun!xtr(b));
This errors as
sort_ex.d(35,43): Error: basic type expected, not (
sort_ex.d(35,43): Error: function declaration without return
type. (Note that constructors are always named 'this')
sort_ex.d(35,50): Error: semicolon expected to close alias
declaration
sort_ex.d(35,50): Error: Declaration expected, not '=>'
> auto sortBy(extractors..., R)(R r) {
> alias preds = staticMap!(makePredicate, extractors);
> return r.sort!preds;
> }
and this as
sort_ex.d(37,6): Error: template sort_ex.sortBy(xtors..., R)(R r)
template tuple parameter must be last one
More information about the Digitalmars-d
mailing list