Bug 5513 – Erroneous example in std.algorithm

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-02-01T07:41:00Z
Last change time
2013-01-08T01:03:24Z
Assigned to
andrei
Creator
simen.kjaras

Comments

Comment #0 by simen.kjaras — 2011-02-01T07:41:15Z
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.
Comment #1 by andrei — 2011-02-01T08:16:59Z
This would be caught by documented unittests...
Comment #2 by andrei — 2013-01-08T00:50:46Z