Infinite BidirectionalRange?

Simen kjaeraas simen.kjaras at gmail.com
Sat Dec 25 05:49:44 PST 2010


Ali Çehreli <acehreli at yahoo.com> wrote:

> Since a BidirectionalRange defines both front() and back(), its being  
> infinite can only come from asymptoting at one or more points in between  
> the two ends. Is that useful?

Consider Cycle[1]. cycle([1,2]) may very well be a bidirectional range,
but it is clearly also infinite. (Currently, it is not bidirectional, but
it is random-access for ranges that support that.)

[1]: http://www.digitalmars.com/d/2.0/phobos/std_range.html#Cycle

-- 
Simen


More information about the Digitalmars-d mailing list