|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-04-14 23:20:57
----- Original Message -----
From: "Hamish Mackenzie" <hamish_at_[hidden]>
> Something else that occurs to me is that I can see no reason not have
> both implementations of the algorithms in the same namespace. The
loki
> style implementation being specialisation for type_list_node and
> type_list_nil. This may be desirable as I expect sometimes recursive
> approach may use fewer compiler resources.
I know it may be hard to believe, especially after I've repeated it
several times ;-), but **the MPL implementation is recursive**!
Furthermore, why speculate? While the simple-looking implementation may
use less compile-resources for short lists, it will always use more
template nesting for long lists and preliminary tests show that it also
compiles more slowly. In order to optimize for short lists you'd need to
make specializations for, say, all lengths up to 10. If performing
matches on those partial specialization doesn't tax the compiler, it
might be a win. However, that's a big if.
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk