[Issue 5513] New: Erroneous example in std.algorithm
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 1 07:43:30 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5513
Summary: Erroneous example in std.algorithm
Product: D
Version: D2
Platform: Other
URL: http://digitalmars.com/d/2.0/phobos/std_algorithm#schw
artzSort
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: websites
AssignedTo: nobody at puremagic.com
ReportedBy: simen.kjaras at gmail.com
--- Comment #0 from Simen Kjaeraas <simen.kjaras at gmail.com> 2011-02-01 07:41:15 PST ---
This examples is on the std.algorithm doc page:
uint hashFun(string) { ... expensive computation ... }
string[] array = ...;
// Sort strings by hash, slow
sort!("hashFun(a) < hashFun(b)")(array);
// Sort strings by hash, fast (only computes arr.length hashes):
schwartzSort!(hashFun, "a < b")(array);
As we all know, *naryFun can't access local symbols, so this example does not
compile.
--
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