|
Boost : |
From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2006-05-10 18:17:34
Tobias Schwinger wrote:
>
> * Design
>
> 1. I'm missing an extension point in the generators to turn them into a
> type-preserving variadic input facility. Elaboration:
>
> Currently e.g. "make_vector" is an inline function. My suggestion is to turn it into
> a global constant of the type of a class template instantiation e.g. "vector_generator<F>".
>
> vector_generator<identity_function> const make_vector = ...
>
> This way it's easy to create user-defined function objects, that take a variable number
> of arguments, turn them into a tuple and finally use this information to create a
> user-defined object (that is, entirely without using Boost.PP). Of course that beast
> would be able to take a stateful functor in its ctor.
Hmmm -- I had hoped for a comment on this one...
Did my review read too negative? Was something unclear?
>
> * Did you try to use the library? With what compiler? Did you have any problems?
>
> Yes.
>
<snip>
>
> I'm still playing with it and hope I can add some details here, soon.
>
I wanted to use Fusion to write something (well, at least half-way) real for review, so I chose to solve this problem:
Call one of a heterogenous set of functors (their call operators might
be templates) based on a runtime index with a complexity of O(log N)
(basically what an n-ary tree structure of nested switch/case blocks
does).
The solution
o handles unary functors only and doesn't bother with the result (simplicity),
o contains numerous workarounds and is far away from being perfect,
o requires an MPL-patch [ http://tinyurl.com/ljfdm] to compile, but
o nevertheless documents my fight with the library, hopefully including lots of mistakes a new user is tempted to make, so it might work good to inspire upcomnig examples.
http://tinyurl.com/l5bxl (source file in the vault)
Fusion rocks!
Regards,
Tobias
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk