Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2004-12-06 14:46:43


On 12/01/2004 04:18 PM, Larry Evans wrote:
[snip]
> Anyway, back to the original question. Is there any interest
> in a "dependent function" where:
>
> dependent_function<I,T> df;
>
There's currently in:

   */boost-sandbox/boost/indexed_types/product.hpp

a prototype of the idea. It can be fairly easily extended
to a counterpart of variant.hpp which allows repeating a
type in the type sequence (see Preconditions: in
variant_fwd.hpp). For example, instead of product and factor
templates, there would be summation and term templates
and instead of product<Tseq>::project<field_id>, there would be
summation<Tseq>::inject<field_id>( at_c<Tseq,field_id> const& ).
The names, project and inject come from the previously
cited nuprl pages.

I suspect the product might be simplified via mpl fold, as
done with mpl::inherit_recursively. I'd like feedback on
any suggested improvements. I'm thinking changing the parameters
to:

   template
     < typename Enumeration
     , template <Enumeration>class TypeMap
>

where Enumeration would have to be an enumeration and TypeMap
would have specializations:

   template<>class TypeMap<e_i>{ typedef i-th type;};

to make clearer what the names of the fields are.


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