irange makes non-emtpy ranges when first is greater than last
还没有人认领这个 Issue。
评估
调研方向
从 irange.hpp 中第 210 行和第 219 行附近的断言开始,然后检查现有的 test_irange 用例。验证报告中的调用会生成空范围且不会进行迭代,并添加或更新测试,使这些用例以零次迭代完成。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- C++
- 星标
- 45
- 派生
- 104
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
boostorg/range 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 65/100
-
难度 1/5 1 小时以内 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 3/5 1-2 天 新手友好度 38/100
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 92/100
espressif/esp-matter#1867 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
isce-framework/isce3#387 ·
-
upstream update
难度 2/5 1-3 小时 新手友好度 68/100
conan-io/conan-center-index#31055 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复