Boost logo

Boost :

Subject: Re: [boost] Lazy list
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-01-19 14:11:25


On Mon, Jan 19, 2009 at 8:35 AM, Scott McMurray <me22.ca+boost_at_[hidden]> wrote:
> On Mon, Jan 19, 2009 at 04:18, David Abrahams <dave_at_[hidden]> wrote:
>>
>> On Mon, 19 Jan 2009 13:07:53 +0800, "Dean Michael Berris"
>> <mikhailberis_at_[hidden]> wrote:
>>>
>>> On Mon, Jan 19, 2009 at 3:17 AM, David Abrahams <dave_at_[hidden]>
>> wrote:
>>>>
>>>> http://www.boost.org/doc/libs/1_37_0/libs/utility/generator_iterator.htm
>>>>
>>>
>>> Shouldn't this be in Boost.Iterators ? Because if I was looking for a
>>> function-backed iterator I would have looked in Boost.Iterators -- and
>>> judging from where it's located, it doesn't make sense to me that it's
>>> in "Utility".
>>
>> Yes, you're probably right
>>
>
> If people are moving iterators around, perhaps they could consider
> moving http://spirit.sourceforge.net/distrib/spirit_1_8_5/libs/spirit/doc/multi_pass.html
> as well -- I didn't find that until after I had written my own.
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>

Just out of curiosity, but it sounds as if to me that your lazy list
is essentially just a function that returns a value for a given
argument, so why not just call a function, passing in the 'index' and
get the returned value to emulate a random-access list, or why not
just use a struct to keep state with its operator() always returning
the next value to emulate the forward-access list, you could even have
both of them as structs anyway and have them fullfill the iterator
pattern too, such as using the above libraries in boost. If any
caching is wanted it could easily be done by a static in a function or
as a member variable in a struct.


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