Sort in return statement

codephantom me at noyb.com
Sat Dec 9 02:34:29 UTC 2017


Anyone got ideas on how to get sort() working in the *return* 
statement?

//------------

ushort[] draw8Numbers()
{
     import std.meta : aliasSeqOf;
     import std.range : iota;
     ushort[] numbers = [ aliasSeqOf!(iota(1,46)) ];

     import std.random : randomShuffle;
     randomShuffle(numbers);

     import std.range : take;
     import std.algorithm.sorting : sort;
     return numbers.take(8); /* ok */
     //return sort(numbers.take(8)); /* I want this, but it won't 
work. */

}

// -------------



More information about the Digitalmars-d-learn mailing list