D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3873 - std.range.repeat should have popBack defined
Summary: std.range.repeat should have popBack defined
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 trivial
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-04 05:59 UTC by Philippe Sigaud
Modified: 2015-06-09 01:27 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Philippe Sigaud 2010-03-04 05:59:19 UTC
std.range.repeat does not define a popBack method and as such cannot be used as a bidirectional range.

Here is the code with the (almost non-existent...) missing function:

struct Repeat(T)
{
    private T _value;
    ref T front() { return _value; }
    ref T back() { return _value; }
    enum bool empty = false;
    void popFront() {}
    void popBack() {}
    ref T opIndex(uint) { return _value; }
}
Comment 1 Masahiro Nakagawa 2010-05-17 09:35:42 UTC
changeset 1517
Comment 2 Masahiro Nakagawa 2010-06-13 13:08:38 UTC
Fixed dmd 2.047.