Boost logo

Boost :

From: Shunsuke Sogame (mb2act_at_[hidden])
Date: 2006-10-23 08:37:07


Thorsten Ottosen wrote:
> Shunsuke Sogame wrote:
>> Hi,
>>
>>
>> If a pointer container holds noncopyable objects,
>> the iterators seem not to meet ReadableIteratorConcept
>> whose 'value_type' must be CopyConstructible?
>
> From
>
> http://www.boost.org/libs/iterator/doc/new-iter-concepts.html#readable-iterators-lib-readable-iterators
>
> it seems that the iterator type itself must be CC and CA. For a given
> iterator a, *a must be convertible to iterator_traits<X>::value_type
> (we'll use T for this below).
>
> For pointer containers, this currently poses quite a problem because of
> its indirected interface: the conversion could succeed if T was defined
> as iterator_traits<X>::reference, but the ReadableIteratorConcept does
> not allow T to be a reference type.
>
> The only thing I can come up with is that pointer container iterators
> does not satisfy the ReadableIteratorConcept, but only the
> ReadableLvalueIteratorConcept.
>
> Does that make sense?

LvalueIteratorConcept?
It seems to be right.
I overlooked 'Readable' and 'Lvalue' is orthogonal.
A concept checker of my alogorithm should have been something like...

     boost::function_requires<
         boost_concepts::ReadableIteratorConcept<Iterator>
         *OR*
         boost_concepts::LvalueIteratorConcept<Iterator>
>();

I don't know how to OR, though :-(
Thanks!

-- 
Shunsuke Sogame

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk