Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-04-11 19:42:24


> The above implementation is useless for 'tiny_list' (and any type sequence
> we use here at work).

It is useful for dot-typelists though, which are the only ones I use.

I think it would be good to find things that are quite easy to do with mpl,
and are very hard to do with recursion and dot-lists. My belief is that for
many processing needs, dot-lists and recursion are simpler.

As an example, count_if's implementation using mpl has 34 lines, defines 3
new types, 1 new namespace, and relies on 5 artifacts defined elsewhere.

The count-if that works only for dot-typelists has 15 lines, defines 1 new
type, and does not rely on any other artifacts than the typelist itself.

I believe it is reasonable to say that the latter code for count_if is
easier to write, read, and understand. If there is claim to the contrary,
really I cannot bring more argument beyond sheer code and the measurements
above.

I understand that count_if is more general, so it is entirely acceptable to
pay a cost in ease of understanding for the benefit of generality. The
question is whether that generality is worth the price in complexity. To me
it looks like it's not - the type processing needs I have are satisfied by
dot-lists and simple algorithms such as count_if above.

Andrei


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