Boost logo

Boost Users :

Subject: [Boost-users] [fusion] const and transform algorithm
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-01-06 16:20:37


Hi,

What is the reason fusion::transform taskes a const Sequence?
template<
    typename Sequence,
    typename F
>
typename result_of::transform<Sequence const, F>::type transform(
    Sequence const& seq, F f);

Does this means that the transform do not change the sequence itself o also its elements?
Why the following do not compiles
    struct get {
        template<typename Sig> struct result;
        template<typename T> struct result<get(T)> {
            typedef typename boost::remove_reference<T>::type ACT;
            typedef typename ACT::result_type type;
        };
        template<typename ACT>
        typename ACT::result_type operator()(ACT& act) const
        { return act.get(); }
    };
    boost::tuple<shared_future<int>,shared_future<char> > t;
    boost::fusion::result_of::transform<
        boost::tuple<shared_future<int>,shared_future<char> > , get>::type res=
            boost::fusion::transform(t, get());

transform call to get()(const shared_future<int>&act). How can I make a transformation changing also the sequence itself?

The result of transform is a transform_view, so the function get is not really called. How can I assign this to a
    boost::tuple<int, char> = ??(boost::fusion::transform(t, get()));
boost::as_vector? Is there a as_tuple function? Should this force the evaluation of the get function?

Thanks,
Vicente


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