Boost logo

Boost :

From: Sebastian Faust (sfaust_at_[hidden])
Date: 2003-11-03 20:06:46


Hi,

>The simplest way would be something like this:
>
> namespace mpl = boost::mpl;
> using namespace mpl::placeholders;
>
> struct pass_through_make
> {
> static vehicle* make( vehicle* ptr )
> {
> return ptr;
> }
> };
>
> template< typename T, typename Base > struct make_vehicle
> {
> static vehicle* make( vehicle* ptr )
> {
> return new T( Base::make( ptr ) );
> }
> };
>
> typedef mpl::fold<
> mpl::vector<car,bicycle,train>
> , pass_through_make
> , make_vehicle<_2,_1>
> >::type factory;
I tested the code above but my compiler gives me the following errors:

c:\projekte\boost-1.30.2\boost-1.30.2\boost\mpl\aux_\preprocessed\msvc70
\apply.hpp(97): error C2039: 'boost::mpl::apply<F,T1,T2,T3,T4,T5>' : is
not a member of 'make_vehicle<T,Base>'
 
c:\projekte\boost-1.30.2\boost-1.30.2\boost\mpl\aux_\preprocessed\msvc70
\apply.hpp(54): error C2039: 'boost::mpl::apply<F,T1,T2,T3,T4,T5>' : is
not a member of 'pass_through_make'
 
Sadly I am not that familiar with mpl-programming and I can't find in
the documentation information about the _1, _2 templates. So it would be
nice if you could give me any further hints.

Furthermore, where can I learn more about the mpl? Is there any
literature? Cause I am really getting fascinated by this compile-time
programming, which I sadly never recognized before.

Thanks in advance
Sebastian


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