Boost logo

Boost :

From: Emily Winch (emily_at_[hidden])
Date: 2002-02-18 10:54:05


Hamish Mackenzie wrote:

> I have been wondering if the mpl gurus could add something like this to
> create runtime code using mpl
>
> class arg_1;
> class arg_2;
> ...
>
> template< typename mpl_code >
> class convert_mpl_to_runtime;
>
> // Loads of specializations in mpl headers
>
> Then the user could write
>
> std::vector< int > v;
> convert_mpl_to_runtime< mpl::insert< arg_1, arg_2, arg_3 > >
> ::execute( v, v.begin(), 1 );
>
> Kind of runtime lambda mpl. Wouldn't make learning mpl any easier but it
> might make it easier to switch code from compile time to run time and
> visa versa.

... and if you could just fix it so it does something different _by itself_
according to whether the user passes in constants or not... so you can get
compile-time evaluation, run-time evaluation or half-and-half (partial
evaluation). You'd need that thing where you can pass integral type template
parameters in through function parameters instead of template parameters.
And a bunch of other stuff, I think, I haven't thought this through yet :)

Emily


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