|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-03-22 08:03:28
Jens Theisen <jens.theisen_at_[hidden]> writes:
> David Abrahams wrote:
>> Jens Theisen <jens.theisen_at_[hidden]> writes:
>>> My reference type is a simple reference, I want to implement an
>>> lvalue iterator (at least in some cases).
>> And why is it only single-pass?
>>
>>> I am trying to make a proxy iterator
>> ^^^^^^^^^^^^^^
>> What do you mean by that?
>
> It is a class templated on a value_type to with implementations can be
> attached (at run time). For example:
>
> List< char > l = makeList(some_std_string) + makeList(some_char_array);
>
> l.begin(), l.end() give you an iterator which type depends solely on the
> value_type (char in this case), rather than the iterator types used as
> backends (std::string::iterator and pointers). These iterators will
> iterate over the std::string first and after this over the char
> array.
We call that "any_iterator" (see
http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?LibrariesUnderConstruction)
>> I don't see why that would be incompatible with forward traversal. We
>> don't even seem to have a requirement that a copy of an iterator
>> compares equal with it. Perhaps we should; then you might be in
>> trouble [Jeremy, Thomas, your thoughts?]
>
> Oh, you're right. I somehow assumed that would be the case. However,
> this is a requirement for Forward iterators, and iterator_faced gives
> the forward_traversal_tag to Forward traversal iterators with reference
> reference type. So it maybe a good idea to add this requirement.
Yeah, I agree.
>> That shouldn't be slow if there's plenty of inlining.
>
> The indirections are runtime indirections.
I see.
Well, a generalized single-pass iterator can't be writable unless it
has a proxy reference, IIRC. Otherwise, how does
*x = a;
work?
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net