On Sat, Jul 19, 2008 at 09:13:08PM +0800, Joel de Guzman wrote:
What do you mean by transformations?
The OP wrote: "I'm trying to copy data between different types of fusion sequences with limited success." If I understand fusion correctly, all compile-time data structures (maps, vectors, lists) are at run-time represented as structs. Is my understanding correct? If so, why provide anything else but vectors? [I have a bunch of other questions, but I'll stop here for now.]
Again, please define "traditional means".
Not using fusion.
What is "rest" and why should fusion cover ML-style pattern matching?
The "rest" is iterators, views, algorithms, ... actually, anything but simple tuples. I did not say that fusion should cover ML-style pattern matching. It was more of a curiosity in the lines of "wow, a bunch of stuff besides tuples, and I have no idea what to do with it.. is there maybe a pattern-matching facility? no.. ok, so what is it good for then?" And I haven't been able to answer the last question to myself. I've browsed through the fusion manual, I've tried to find a use for fusion on the project that I'm currently working on (mostly algorithmical stuff), and I've failed to find where fusion could be useful to me and how it would simplify the program. So, since I'm unable to find a use for fusion in the stuff I'm working on, there are two possible conclusions: 1. The problem lies in the class of problems I'm working on, so I asked the question to find out to which class of problems is fusion suited to. 2. The problem lies in me, in which case the answer to my question will give me a real-life example of other "thinking patterns".
If anyone can suggest a motivating example and how to improve the docs, I'd appreciate it a lot.
A random page from the docs:
http://www.boost.org/doc/libs/1_35_0/libs/fusion/doc/html/fusion/container/s...
Keys are compile-time types. What is the advantage of set over a simple struct
having exactly one element of each type? An example of what is easier achieved
this way (or even just a bunch of e.g. variables on the stack) rather than with
a struct would be helpful.
The documentation has artificial examples. Providing some context, e.g. by
describing a real-world problem which caused the algorithm / function / data
structure to be added to fusion would be helpful.
===
OK, copy-paste from some of my code:
++npeers[ret.first->first.first->vid_];
++npeers[ret.first->first.second->vid_];
ret is a return value from std::map::insert (which is a pair of iterator into
the map and boolean), where map is std::map