diota整与浮的不一致

原文

import std.range.iota;
auto r = iota(5, 0);
//r为空区间
auto r = iota(5.0, 0);
//这里为异常

很难调试,这样好吗?

简之,iota的常规popFront()是个平凡的

front += step

但对浮点,它是++n.因此front可为:

begin + (n * step)
posted @ 2023-01-07 10:10  zjh6  阅读(18)  评论(0)    收藏  举报  来源