|
Boost : |
Subject: Re: [boost] [range] RFC: span(iterator, size)
From: Akira Takahashi (faithandbrave_at_[hidden])
Date: 2013-10-29 14:15:36
2013/10/30 TONGARI J <tongari95_at_[hidden]>
> 2013/10/30 Akira Takahashi <faithandbrave_at_[hidden]>
> ...
> > What do you think about out of range check?
> >
>
> I'd say, it's the user's duty to ensure it won't go over the end.
>
>
> > What situation is it useful?
> >
>
> When you want to ignore the difference between RandomAccessIterator &
> ForwardIterator while keeping the efficiency of RandomAccessIterator.
>
> Some API may look like this: function(iterator, n, ...)
> that only require iterator to be ForwardIterator, but the implementation
> may sacrifice the efficiency of RandomAccessIterator, just because the
> implementor doesn't want to bother tag-dispatching for such optimization...
> (OK, I'm the one)
>
Thank you. I understood your motivation. My opinion is here:
First, I wouldn't like to provide iterator interface in Boost.Range
functions (expect begin/end).
In my opinion, iterator is low layer interface.
It is not Boost.Range layer.
Second, I rethink interface by first reason:
r | random_access_taken(n); or
r | random_access_span(n);
I don't think useful the function (explicit efficient phrase).
At least, we need better name for random access.
However, my `taken` implementation hasn't optimization for random access
iterator.
I'll add optimization to `taken` implementation.
Thanks,
Akira
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk