Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2007-01-17 20:32:45


Sohail Somani wrote:
> Hi,
>
> I've attached a diff against HEAD for converting list0 and list1 in
> the bind implementation to using fusion::tuple (instead of storageN)
> as was recently suggested in the users mailing list by Peter Dimov.
> The main reason for doing this was to allow easy iteration over the
> list element types so that things like minimum arity for a bind
> expression can be computed. The solution I suggested was pretty hacky
> to say the least but it worked ;-).
>
> Anyway it should be pretty easy to do (if not just tedious). The
> tests compile and pass here for these changes (g++-4.1). Do the
> changes look sensible? The only sticking point seems to be the
> accept/visitor thing that appears to be unused except for in boost
> signals. Should this also be carried over? I can complete a patch and
> submit a track item in the next couple of days.

I would suggest "adapting" bind's tuples to fusion instead of
replacing it with fusion's vector/list. The main advantage of
adapting is that it is non-intrusive. Remember that one of
bind's biggest advantage over lambda/phoenix is that it works
with a lot more compilers. Alas, fusion requires a fairly
conforming compiler. Once you adapt bind's tuples to fusion,
you can now use its facilities (algorithms, etc.) for free.

(for an example of how to adapt an existing sequence/tuple over
to fusion, check out boost/fusion/sequence/adapted/boost_tuple/
and friends.)

> PS: I've also done the same change with phoenix::tuple so whichever
> one is preferred

FYI, the latest phoenix version already uses fusion.

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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