Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2005-03-24 09:07:55


Jens Theisen <jens.theisen_at_[hidden]> writes:

> David Abrahams wrote:
>>>List< char > l = makeList(some_std_string) + makeList(some_char_array);
>> We call that "any_iterator" (see
>> http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?LibrariesUnderConstruction)
>
> I think I focusing more on compounds like the above concatenation, but
> also filters and maps. I want to have the list expressiveness of Lisp,
> Haskell or Python to define what collections I want to have rather than
> using the stl algorithms to tell how collections are being contructed.
>
>> Well, a generalized single-pass iterator can't be writable unless it
>> has a proxy reference, IIRC. Otherwise, how does
>> *x = a; work?
>
> According to the new iterator concepts it should be perfectly fine to
> have an lvalue access single-pass iterator.

Yes. My point is that the iterator_facade framework is making some
deductions about your iterator's capabilities based on the reference
type you supplied. The logic is that if *x returns a real reference,
then either the iterator must not be writable, or the referenced
object must persist past the iterator's lifetime and therefore the
iterator could be multipass. I suppose it's possible to build a
writable single-pass iterator that just throws out the data you write
into it...

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