Shout out to D at cppcon, when talkign about ranges.

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 2 15:57:54 PDT 2015


On 10/2/2015 10:49 AM, Eric Niebler wrote:
> On Thursday, 1 October 2015 at 21:03:16 UTC, Walter Bright wrote:
>> I don't see evidence that C++ had ranges before D. Boost ranges are not what
>> we think of as ranges.
>
> Why not?

Because it returns iterators. It should expose functions (or operators) that do 
this:

    front
    popFront
    empty

not iterators. Instead, it has:

    begin
    end
    empty

The begin and end are iterators, and don't encapsulate (i.e. constrain) what can 
be done with those iterators. For example, begin can return an iterator that can 
be used to increment right on past the end. The iterator itself has no knowledge 
of where the end is.

This is the issue that D ranges (and Matthew's and your's) solve. I believe the 
difference is fundamental.

http://www.boost.org/doc/libs/1_34_0/libs/range/doc/range.html

It's possible I misunderstand it, please correct me if so.


More information about the Digitalmars-d mailing list