[Issue 9626] More precise error message in some cases when failed template constraint

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 4 15:02:25 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9626



--- Comment #1 from bearophile_hugs at eml.cc 2013-03-04 15:01:50 PST ---
An example of the problems this enhancement request should help solve. A
question from "deed" in D.learn:

http://forum.dlang.org/thread/djynnhlbfdxyurxvxuzs@forum.dlang.org


> Why randomAccessRange.array() before calling sort?
> The std.algorithm.sort doc says: "Sorts a random-access range ..."
> 
> 
> import std.algorithm, std.array;
> 
> long[] source = [2, 0, 1];
> 
> auto mapped = source.map!("a * 10");
> assert (isRandomAccessRange!(typeof(mapped))); // Passes. Implies possibility
>                                                // to to use std.algorithm.sort?
> 
> auto mappedThenSorted = mapped.sort();         // Error
> auto mappedThenSorted = mapped.array.sort();   // Works (and 
> used in examples)
> 
> 
> What am I missing in the documentation?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list