irange makes non-emtpy ranges when first is greater than last
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
Research direction
Start in irange.hpp at the assertions around lines 210 and 219, then inspect the existing test_irange cases. Verify the reported calls produce empty ranges without iterating, and add or update tests so these cases complete with zero iterations.
Written by the indexing model from the issue text.
Description
the simple example irange(-5) I would expect to be an empty range, i.e.
int32_t end = -5;
int64_t count = 0;
for (int32_t i = 0; i < end; ++i)
// this line will never be reached
++count;
std::cout << count << std::endl; // 0
count = 0;
for (auto i : boost::irange(end))
// this should never be reached, but it will
// iterate past int32_t max until it reaches -5
++count;
std::cout << count << std::endl; // 4294967291
My expectations is the following tests should pass with no iterations, but many fail on asserts in the test but will be large ranges in release
test_irange(-5);
test_irange(0, -5); // this fails on assert at irange.hpp#L210
test_irange(5, 10, -1); // this fails on assert at irange.hpp#L219
test_irange(10, 5, 1); // this fails on assert at irange.hpp#L219
- Dominant language
- C++
- Stars
- 45
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/range
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
ros2/message_filters#338 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
subsurface/subsurface#4984 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
flutter-webrtc/flutter-webrtc#2206 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
google-ai-edge/LiteRT-LM#3739 ·