Bug 4800 – Incorrect retro example

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-09-03T08:36:00Z
Last change time
2010-09-03T16:29:40Z
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2010-09-03T08:36:15Z
From http://www.digitalmars.com/d/2.0/phobos/std_range.html#Retro Full example: import std.range; import std.algorithm; void main() { int[] a = [ 1, 2, 3, 4, 5 ]; assert(equal(retro(a) == [ 5, 4, 3, 2, 1 ][])); } The assert should be: assert(equal(retro(a), [ 5, 4, 3, 2, 1 ][]));
Comment #1 by andrej.mitrovich — 2010-09-03T08:37:13Z
One other thing, what is the purpose of the extra square brackets next to the array literal? This compiles fine as well: assert(equal(retro(a), [ 5, 4, 3, 2, 1 ]));