Subject: [boost] [variadic_templates][mpl]announcement:sandbox now has variadic_templates directory
From: Larry Evans (cppljevans_at_[hidden])
Date: 2009-09-12 14:38:14
There is now a sandbox directory for variadic templates:
The tests in variadic_templates/libs/mpl/test/Jamfile have all passed.
Some of those tests have been slightly modified to accommodate the
variadic template version of mpl sequences.
BTW, it's important to apply the gcc patch mentioned here:
All sequences have been changed to use a new template:
whose last argument is a parameter pack. That change also required
a new binary template for each sequence:
where X is one of:
One reason for that change was to highlight the similarites of
Some other fold additions were:
The foldr and foldl correspond roughly to iter_fold and
reverse_iter_fold (or the other way around, I can't remember which).
The reason for these additions is that they reflect more closely the
way foldr and foldl are done in haskell, as indicated by the comments
in the .hpp files.
One useful application of the pattern expansion mentioned in section
is their use to easily define SEQ_c in terms of SEQ, where SEQ is any
sequence. For example:
< typename Integral
, Integral... Values
typedef Integral value_type;
Another addition is package_range_c.hpp which can be used to do
something similar to range_c. The main motivation for this was the
make_indexes on p. 16 of:
It was used in a prototype tuple implementation in:
Package_range_c was also useful in the implementation of unpack_args.
A really interesting application of these pattern expansions might be
another implementation of the cross_product template:
The reason I think it would be useful is because the expansion of:
where ValueI is the i-th element in Values...
Now this is a cross product of a single element, Integral, with each
element in Values...; hence, I would think that it would be a simple
matter to just repeat this for any number of elements. IOW, instead
of integral_c, there could be:
template<typename Left, typename...Rights>
and then that, somehow, could be done for each element in some list of
Left's. Would somebody like to try this?
Hope somebody else finds this useful.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk