Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2003-11-17 09:18:30

Bernard <yahoo_at_[hidden]> wrote:
> Bonjour,
> Le Vendredi 14 Novembre 2003 15:52, Joel de Guzman a écrit :
>> Bernard <yahoo_at_[hidden]> wrote:
> ...
>>> (for example:
>>> template<typename N, typename TupleOfTuples>
>>> struct select_Nth_view :
>>> transform_view<filter_view<tuple_view<TupleOfTuples>, ... >{};
>> I think that's a good strategy. Have you tried it?
> I came up with the following :


Rockin! You just wrote the first fusion application :-) I'm really glad you
found it easy(?) considering the pre-alpha status of the code, not
to mention the lack of documentation! Wow!

Anyway, can I use that in the examples? If so, would you mind sprinkling
some comments here and there?

> I was wondering wether it was possible at all and Fusion made it
> really easy ! Well done !

Gee thanks! I'm close to releasing fusion beta, then fusion 0.9. I would
appreciate comments, suggestions to make it easier to use, etc.

> I enjoy your tuples so much that I want to use them everywhere. Well
> not only that but I also would want everybody to use them everywhere
> !

Me too :-)

> It seems only logical to me when doing metaprogramming:
> You want to work with fonctions, so you have to know things about them
> (eg. number and types of arguments). Why would you not decide that
> every fonction should only take one argument ? Of course it would be
> a tuple. All the ugly code handling differents number of arguments
> (and limit on that number) would be factored in tuple. Other meta
> programming libs would know that they only have to handle one args,
> and they can then query about the number of elements in the tuple
> etc....

You know what? That's exactly my philosophy and is the main
implementation strategy of Phoenix (and soon, hopefully, LL/Phoenix).
Guess why I wrote fusion <hint, hint... :->

> Such a convention must be used across the board to be useful and this
> is not possible for classical dynamic C++, but if you are to decide
> convention for compile time C++, I do not see any reason not to do
> it.
> I would also define integral arguments to be wrapped in int_<>
> (uint_<> ) for consistency.

Yes, that's truly useful.

> I know it my sound strange, but I really think that such a
> "restricted" API would only be beneficial, because it would only give
> more powerful meta-programming.

Not strange at all. At least not to me.

> Bernard
> PS: Is there a reason not to have
> tuple<> make_tuple(){ tuple();} for consistency ?

Not sure. Perhaps we should ask Jaakko.

> PS2: Even if you think my idea of using only 1 tuple as argument is
> crazy, I think the argument to always have classes modeling Integral
> Constant (for example with tuple_element<> still holds.

It's not crazy. I do it everyday since the day Phoenix was born :-)

> PS3: Just wanted to say it again : fusion *rocks* :-)

MANY THANKS! Now those endless nights are all worth it :-)
And needless to say. All this would be very difficult, if not impossible,
without MPL!


Joel de Guzman

Boost list run by bdawes at, gregod at, cpdaniel at, john at