Boost logo

Boost :

Subject: Re: [boost] [Concept Check] ContiguousIterator
From: David Abrahams (dave_at_[hidden])
Date: 2010-10-07 09:58:15


At Thu, 07 Oct 2010 13:23:14 +0100,
Mathias Gaunard wrote:
>
> On 07/10/10 13:13, Mathias Gaunard wrote:
> > On 05/10/10 20:45, joel falcou wrote:
> >> Using BCC, s there any way to refine RandomAccessIterator so the cocnept
> >> captures the fact that the address of two consecutive value iterated over
> >> are contiguous in memory ?
> >>
> >> I can't get any proper expression to check for this in a proper way.
> >
> > Iterators will need to register nominally to the concept. Specialize it
> > for pointers and any kind of normal vector-like iterator (too bad we
> > don't have a standardized name for that).
> >
> > You may want to make sure it works correctly with iterator_adaptor as well.
>
> __gnu_cxx::__normal_iterator will forward the iterator_category from
> pointers already, so it doesn't need special care.

You could make the iterator category tag a class derived from
random_access_iterator_tag. That would be a good protocol for new
iterators, anyway. You'll need to specialize in order to retrofit
this for existing iterator types.

-- 
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