Boost logo

Boost Users :

From: Joel de Guzman (joel_at_[hidden])
Date: 2007-01-16 00:42:55


Yuval Ronen wrote:
> If I have a
>
> typedef fusion::tuple<X, Y, Z> T;
>
> can I somehow create a T instance like
>
> T t(1, "hello");
>
> and by that I mean that each of T's elements (of types X, Y and Z) would
> be constructed using the constructor that accepts an int and a string,
> assuming there is such a constructor for all T's elements. If there
> isn't such constructor for all T's elements, then it shouldn't compile,
> of course.

No.

> Of course using the exact syntax above is not possible, because it's
> reserved for something else, but any other syntax would be just as good
> (perhaps using in_place_factory).

Does it have to be done at construction? If not, you can use for_each.
If yes, it might be interesting to have a forward fusion sequence that
generates its elements on the fly (a generator). But this also presents
some complications because you want the elements to be constructed
with 2 arguments. So, I have no immediate ideas for you. If you have
some specific suggestions, I'm all ears.

Regards,

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

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