|
Boost : |
From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-07-28 13:25:47
I think I've put the finger on the exact thing I enjoy less in MPL's design.
It is that it supports multiple containers, while I believe that dot-lists
(LISP-style lists) would be sufficient.
As a consequence of supporting multiple containers, algorithms are more
complicated and contorted in both interface and implementation.
So far, however, I haven't seen any piece of evidence on why a variety of
type containers would be needed instead of dot-lists. Dot-lists satisfy the
closure property (can represent any data structure), and are easiest and
most natural to manipulate with C++'s template engine.
An argument that was aired is that various compile-time structures would
lead to different compile times. Consequently, the argument goes, the
developer would select the structure that leads to the least memory occupied
and the fastest compile time. However, experience shows that various
compilers prefer various data structures, depending on how the compilers
implement templates. So if one is to write portable code, there is no clear
choice of a structure over another.
In light of the above, MPL's design that is similar to STL's in that it
separates containers from algorithms, doesn't quite hit the mark. While the
analogy is remarkable, I happen to believe that that analogy is not
beneficial.
Andrei
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk