On 7/10/12 3:48 AM, Jonathan M Davis wrote:
On Monday, July 09, 2012 16:16:42 Andrei Alexandrescu wrote:
Another example:

auto str = ["foo", "bar"].map!(x =>  x);
auto f = str.sort();

Results in:

http://pastebin.com/BeePWQk9

The first error message is at clear as it goes:

Error: r[i2] is not an lvalue

It's only clear if you go look at sort's implementation, and that failure
isn't even in sort itself! It's in its helper function, swapAt. Either sort's
template constraint should fail when it's given a range that won't work with
it, or it needs a static assertion which tells the programmer exactly what's
wrong. The fact that r[i2] isn't an lvalue means nothing without actually
digging into the code, which the average programmer should not have to do.

Agreed, thanks for the bug reports.

Andrei

Reply via email to