[Issue 3098] New: std.algorithm.reduce example can not compile
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jun 27 02:15:43 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3098
Summary: std.algorithm.reduce example can not compile
Product: D
Version: 2.030
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: samhu.samhu at gmail.com
CC: bugzilla at digitalmars.com
Below example is from std.algorithm.reduce:
double[] a = [ 3.0, 4, 7, 11, 3, 2, 5 ];
// Compute minimum and maximum in one pass
auto r = reduce!(min, max)(a);
// The type of r is Tuple!(double, double)
assert(r.field[0] == 2); // minimum
assert(r.field[1] == 11); // maximum
// Compute sum and sum of squares in one pass
r = reduce!("a + b", "a + b * b")(0.0, 0.0, a);
assert(r.field[0]==35);
assert(r.field[1]=233);
Can't compile.Error msg:
testFormat.d(22): Error: template std.algorithm.Reduce!("a + b","a + b *
b").reduce(E,Range) does not match any function template declaration
testFormat.d(22): Error: template std.algorithm.Reduce!("a + b","a + b *
b").reduce(E,Range) cannot deduce template function from argument types
!()(double,double,double[])
Not sure whether this is a bug.
--
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