|
Boost : |
Subject: Re: [boost] lifetime of ranges vs. iterators
From: David Abrahams (dave_at_[hidden])
Date: 2008-09-05 09:39:46
on Fri Sep 05 2008, Arno Schödl <aschoedl-AT-think-cell.com> wrote:
> In the case of a base forward_iterator, we can do without any space overhead
> with the same trick used for the filter_iterator. We implement a strided_range
> and then derive the strided_iterator from it. The strided_range stores its
> underlying random_access range, and adapted_range interface::increment/advance
> can check the underlying range for empty. It would be like:
>
> increment() {
> for( difference_type i=0; i<N && !base.empty(); ++i ) {
> base.increment(); // the adapted_range::increment which increments begin,
> base is a range
> }
> }
I don't think you're fully appreciating what a huge impact such a
complex implementation of increment() would have on performance.
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk