
Joel de Guzman wrote:
Shunsuke Sogame wrote:
Weapon Liu wrote:
I think this is the right place to ask this question. As cool as boost::fusion is, there's still one question that bothers me, that is, if boost::fusion is the hammer, then what's the nail?
I sure know that it's generic( more so than boost::tuple) and it's complete( with a bundle of algorithms and cool utilities), and it seems that it "solves" some problem quite well( when I read the documents).
However, I found it bothering that the documents didn't even mention one real-world application( boost libs aside).
Based on my experience, the most frequent scenarios where boost::tuple/fusion is useful are those where one needs a generated-on-the-fly struct for holding return values bundle, or where one needs to return multiple values transparently( well, nearly so), just like those lua does. The fusion/tuple seems more generic? Functional languages have curried and uncurried functions. C++ is considered as a langauge that has "fused and unfused" functions?
void foo(int, int); // unfused void foo(tuple<int,int>); // fused
Note that functional languages regard unfused one as "tupled"; conFusing :-)
Well, once an unfused function is converted to fused one, it is unary. Some kind of job will be easy; e.g. function composing.
Kinda con-fusing :-) But once you get the essence, it really makes sense :P
FYI, here is 'compose' implementation using con-fusing. It might be no practical use, though. :-) http://tinyurl.com/y9uamg Regards, -- Shunsuke Sogame