[Issue 22272] [std.range.retro] should behave the same as foreach_reverse

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 3 20:27:49 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22272

Dlang Bot <dlang-bot at dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #1 from Dlang Bot <dlang-bot at dlang.rocks> ---
@iK4tsu created dlang/phobos pull request #8231 "Fix std.range.retro not
behaving the same as foreach_reverse" fixing this issue:

- std.range: fix function 'save' to only be implemented if the Range is has a
valid 'save' method

  The 'retro' Range only does one thing, iterates a Range back to front. This
  follows the same semantics as a 'foreach_reverse'. However, with
'foreach_reverse'
  it accepts Ranges that have valid 'popBack', 'back', and 'empty' functions.
The
  'retro' Range, on the other hand, forces the user to implement 'front',
  'popFront', and 'save' functions as well because it follows the Range
hierarchy.
  For a Range that only iterates back to front, accomplishing the same as the
  'foreach_reverse', it should behave the same way.

  Fixes Issue #22272

  Signed-off-by: João Lourenço <jlourenco5691 at gmail.com>

https://github.com/dlang/phobos/pull/8231

--


More information about the Digitalmars-d-bugs mailing list