On Thursday, 8 June 2017 at 01:57:47 UTC, Andrew Edwards wrote:
Ranges may be finite or infinite but, while the destination may
be unreachable, we can definitely tell how far we've traveled.
So why doesn't this work?
import std.traits;
import std.range;
void main()
{
string[string] aa;
// what others have referred to as
// standard sort works but is deprecated
//auto keys = aa.keys.sort;
// Error: cannot infer argument types, expected 1 argument,
not 2
import std.algorithm: sort;
auto keys = aa.keys.sort();
// this works but why should I have to?
//import std.array: array;
//auto keys = aa.keys.sort().array;
foreach (i, v; keys){}
}
If I hand you a chihuahua for grooming, why am I getting back a
pit bull? I simply want a groomed chihuahua. Why do I need to
consult a wizard to get back a groomed chihuahua?
aa.keys.sort() should just work as is: aa.keys returns a
string[], and that's a random access range that can be sorted.
What exactly is the error?