Boost logo

Boost :

Subject: Re: [boost] Lazy list
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-01-18 07:52:46


Zachary Turner wrote:
> It occured to me that boost is lacking a true lazy list. I feel like this
> should be possible to implement on most compilers, although I doubt I have
> the metaprogramming expertise to be able to implement such a data structure
> myself. But nonetheless I think this would be extremely useful. Lazy lists
> are basically lists that don't store the actual values of the list, instead
> they store a -function- that is called each time the next element of the
> list is requested, and the result of that list is returned.

Such things could easily be done with range adaptors.

auto fibo = make_range(0, 1) | append_rec(_1 + _2);

This could generate the infinite fibonacci range.


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