Boost logo

Boost Users :

Subject: [Boost-users] [Fusion] transform with more than 2 parameters, at_c on arithmetic types
From: joel (joel.falcou_at_[hidden])
Date: 2009-08-16 02:47:33


I need to make a function that takes a N-ary function object F and N+1
fusion sequence R, S0, .., Sn-1 and do,
for each element of those sequences :
at_c<i>(R) = F( at_c<i>(S0), .., at_c<i>(Sn-1) );

I tried to use combo fo zip+transform but I failed miserabily.
So is there anyway to do this beside writing a map function by hand
using Boost.PP ?

More over, I want my map function to have some of its argumetns being
arithmetic types.
However fusion::at_c<N>(T) with T arithmetic fails cause T is tagged as
non_fusion_tag.

Is it possible, without ill effects to add the support for non-fusion
type for at as in :

namespace boost { namespace fusion {
namespace extension
{
    template<> struct at_impl<non_fusion_tag>
    {
      template<class T,class N> struct apply
      {
        typedef typename mpl::if_c<
            is_const<T>::value,
            T const&,
            T& >::type type;

        static type call(T& seq) { return seq; }
      };
    };
}
} }

Or is it better for me to do my own at that tag-dispatch between fusion
type and non-fusion type ?

-- 
___________________________________________
Joel Falcou - Assistant Professor
PARALL Team - LRI - Universite Paris Sud XI
Tel : (+33)1 69 15 66 35

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