Boost logo

Boost :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-03-10 10:27:26


AMDG

Markus Werle wrote:
> Hi!
>
> I want to discuss the internal data structure expr<>:
>
> I like the way expr<> is built regarding to the first and second
> template argument: It is well thought and done to have the
> expression tag as first argument and some fusion-compatible
> typelist as its second argument containing the operands.
>
> OTOH the third template argument contains redundant information:
> The docs say: "Proto expression nodes are valid Fusion random-access
> sequences of their children nodes."
> So the information about the number of arguments is accessible via
> some size<T>::type metafunction e.g. depending on
>
> result_of::distance<result_of::begin<S>::type
> result_of::end<S>::type>::type?
>
> In my unfinished attempts to write a paper about ET library design
> (now obsolote, thanks to Eric) I have a statement that any expression
> representation taking more than 2 template arguments is wrong.
>
> Eric, since you always have a good reason for your design:
> Could you please elaborate on this?
>
> Also I ask myself whether there was a good reason not to follow
> mpl and use types to represent numbers.
> I'd prefer at least some parallism to mpl here: size_t<c>?
>

I believe that it is needed to allow partial specialization.
expr<Tag, Args, 0>, expr<Tag, Args, 1>, ...
And users don't need to care about it, since it has a default.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk