Boost logo

Boost Users :

Subject: Re: [Boost-users] [range] for_each and std::map of std::list
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-04-07 05:47:37


On 06/04/2011 23:14, Thorsten Ottosen wrote:
> Den 06-04-2011 22:55, Neil Groves skrev:
>
>> I've been interested in implementing something similar for a while. I
>> was thinking slightly more generally that any n-dimensional structure
>> can often be linearised or projected into a linear sequence. Hence this
>> would enable not just the above example to work, but many standard
>> algorithms could work with tree structures, hyper-cube trees, directed
>> acyclic graphs etc. I've implemented a number of these already, but
>> wanted to gain experience with them in my own projects before committing
>> them to the trunk.
>
> Cool. I have a little problem seeing how it works with acyclic graphs.
> For example, there are many ways to do this. Which one do we pick?

True, there are many ways to linearize a n-dimensional structure.
Consider a matrix, do you start with rows or with columns?

> I think the container of containers case meets 90% or more of all use
> cases. A container of containers of containers can be done manually by
> applying it twice.

For ranges of ranges (of ranges...), unless they're random access, I
don't think anything but linearizing in the "natural" order of iteration
makes sense.


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