
----- Original Message -----
From: "Joel de Guzman"
vicente.botet wrote:
----- Original Message ----- From: "Joel de Guzman"
To: Sent: Tuesday, January 06, 2009 11:26 PM Subject: Re: [Boost-users] [fusion] const and transform algorithm 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.
Can for_each mutate the sequence elements?
Yes.
if yes, would the following get a
transformation I'm locking for?
I don't know. I'm not sure what you are looking for.
I just wat to apply the unction get to a tuple of futures and reviver the stored values. T& future<T>::get() is non const
vector
v; v = transform(v, f); I was lock for in the documentation and I have not found this assignation. Where in the documentation can I found that I can do that?
See the sequence/views concepts and the docs for the containers. For example (http://tinyurl.com/84vdvp):
Notation: v Instance of vector s A Forward Sequence
Expression Semantics: v = s Assigns to a vector, v, from a Forward Sequence, s.
Thanks for the reference. I was looking for a function prototype. BTW, the example is not in line with the functions.
vector
If for_each can change/mutate the sequence itself, why don't have a mutating_transform that takes a Sequence& and not a Sequence const&
Because it is not needed.
Just a last question. How move semantics maps with purely functional Sequences? Do you plan to add move semantics for the elements of the tuple? The concept of MovableSequence has a sens for you?
Makes sense. Last BoostCon, we had a workshop about implementing Fusion for 0x incuding move. We'll have it when it is available.
Great! Would you try with a Boost.Move library? Thanks, Vicente