Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-08-05 15:53:34


Hi Dave,

BTW, your email text keeps showing up as an attachment, which makes it
impossible for our email reader (pine) to quote it properly in the reply.

>From greened_at_[hidden] Mon Aug 5 15:29:01 2002

[snip]
> Ok, that sounds reasonable. I've attached a revised example. This

Thanks!

> The example includes a car structured as taking a typelist of
> NTPs and a car taking individual scalar NTPs as in the sandbox
> example. I was quite pleased at how easy it was to implement the
> latter on top of the former.

Inheritance is a pain to use like this... in a real class you'd need
forwarding constructors :( Also there are other problems, for example, if
you tried to implement iterator_adaptor using that approach you would have
troubles with the return type of operator++, which has to be by-value, and
the same type as the most-derived class.

> I can't say that this is the best syntax. It's a stab at a better
> syntax, but part of the reason I'm posting this is to get ideas.
> It still needs to be ported to MPL. I'm waiting to see whether
> MPL is accepted and for an official release assuming that happens.

> // Set the model and tranny
> typedef mpl::make_typelist_2<mpl::ntp<model_tag, limited_edition>,
> mpl::ntp<transmission_tag, manual> >::type
> limited_manual_config;
> car_as_typelist<limited_manual_config> limited_manual_car;

The above syntax is less clear than our current appraoch:

typedef car< Model_is<limited_edition>, Transmission_is<manual> >
   limited_manual_car;

> I see two main advantages to this alternate approach:
> - Declaration of parameters and defaults is decoupled from
> the binding of parameters to defaults. No car_defaults is
> necessary though it could of course be used for convenience.
> Model_is, etc. are replaced by the "standard" ntp<> class.

This seems pretty minor to us.

> - The use of typelists allows an arbitrary number of template
> parameters. I can't say with absolute certainty until I play
> around with this some more, but I think I can get all of the
> functionality of the sandbox NTP with the typelist mechanism.

There is no need for this. At design time you know how many template
parameters (or features) are be needed.

Regards,
Jeremy and Jaakko

----------------------------------------------------------------------
 Jeremy Siek http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------


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