
vicente.botet wrote:
Hi,
What is the reason fusion::transform taskes a const Sequence? template< typename Sequence, typename F > typename result_of::transform
::type transform( Sequence const& seq, F f); Does this means that the transform do not change the sequence itself o also its elements?
Yes. Fusion transform returns a lazy (transform) view. This view is non-mutating. It is not like STL's transform which mutates the target container in place. Fusion's is purely functional and lazily evaluated.
Why the following do not compiles struct get { template<typename Sig> struct result; template<typename T> struct result
{ 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 t; boost::fusion::result_of::transform< boost::tuple , 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
= ??(boost::fusion::transform(t, get())); boost::as_vector? Is there a as_tuple function? Should this force the evaluation of the get function?
As I said, Fusion transform is purely functional. The result of a transform
is a view. The function will only be called when you iterate over the
view. The transformation does not change/mutate the sequence itself.
If that's what you want, you can assign the view back to the original
container. For example:
vector