|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-12-12 11:01:44
----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>
> > - It should be at instead of TypeAt.
> > - It should be find instead of IndexOf.
> > - It should be push_back instead of Append.
> > - It should be unique instead of NoDuplicates.
>
> Not in this case, actually.
>
> The Lisp-style version of type lists (or compile-time lists in general)
> don't follow the STL idiom; they follow the Lisp idiom.
>
> Renaming 'append' to 'push_back' is not simply unnecessary, it's harmful.
That's an interesting point of view that I never expected. Why is it
harmful?
There's actually some question whether push_back should be an available
operation on regular type_lists, since it's an O(N) operation, and that can
translate into O(N^3) or something in real compile-time depending on the
compiler. Actually, when I did log/log plots of these things it wasn't clear
that even the fastest compilers were polynomial.
Algorithms implemented in terms of push_front tax the compiler much less, in
general.
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk