Skip to content

range1 not working like python #361

Description

@chuffa

I make quite a heavy usage of the range1() functionality and found that it does not work as I would expect it to when e is less than b. For example for(auto i : range1(3,0) ) just keeps counting upwards instead of doing nothing.

Python ranges work differently and I think the idea of these c++ ranges is to mimic the python behavior. In any case, trying to make such a range should at least be caught somehow.

As far as I understand only line 57 of iterate.h needs changing by replacing != by <= (maybe >= too many negations):

return curr_ != other.curr_;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions