From: Jaap Suter (J.Suter_at_[hidden])
Date: 2002-09-05 06:45:23
I've been working with the Boost MPL the last few days, and I have a few
remarks and questions.
I am using a clean Boost 1.28 distribution downloaded from
http://boost.sourceforge.net/release/boost_1_28_0.zip over which I installed
the full library + all its dependencies that I downloaded from
I hope that is the latest 'stable' release. If not, where can I find that
one? I'm a little hesitant to dive into CVS myself. I prefer nicely packaged
zip files that work right away :).
First of all, even though the formal review is over, I want to say that the
container-iterator-algorithm abstraction is worth it. I followed the
head-tail vs container abstraction discussion with great detail. In fact,
about a week ago I almost dumped the MPL in favor of my own head-tail system
which at least I could understand. But now that I have given the MPL some
time, the stuff has definitely become a time-saver so far. Once you
understand the fold-algorithm, everything becomes really easy.
I'd like to make the following remarks:
1. The file boost/mpl/contains.hpp contains a bug in my distribution. It
includes "boost/mpl/logical_not.hpp" whereas that should be
2. What happened to mpl::for_each and mpl::push_back? Did I overlook them?
Or will they be in the final release?
3. Is there any chance on a mpl::set container? I made my own push_back that
checks whether an element already exists, and does nothing in that case. But
I am sure more people could use an mpl::set.
4. In my humble opinion (no offense to any of you) but the documentation can
definitely be improved. To sum up:
- Why is the documentation (mostly the paper) constantly defending
itself? It reads as if the paper is trying to come up with arguments for the
existence of the MPL. I sure appreciate a 'rationale' section, but the way
it is now, it clutters the actual content. People with an interest in the
MPL should already know why meta programming is neat. If they don't, just
give them a link to the Todd Veldhuizen papers.
- Where is the reference documentation for mpl::if_, mpl::apply_if,
lambda facilities, etc? There is more in the mpl than the reference
- I'd like a better explanation and more examples of both the
fold/algorithm stuff, and the lambda facilities.
- Why does the mini-tutorial only talk about compile-time if's?
Note: I know that writing documentation can be a chore. If I can learn the
MPL from the current documentation, it _must_ be good (after all, if a
dumb*ss as I can learn it...). But I just think there is room for
5. I highly recommend adding a default unsigned_int_c to the library. I am
using integral_c< size_t, n > very often.
6. Any comment on the following code and why it doesn't compile?
typedef boost::mpl::vector_c< size_t, 0, 1, 2, 3, 4 > grade_list_1;
typedef boost::mpl::vector_c< size_t, 2, 3, 4 > grade_list_2;
typedef boost::mpl::fold< grade_list_2, grade_list_1,
boost::mpl::contains< boost::mpl::_1, boost::mpl::_2 >,
boost::mpl::push_front< boost::mpl::_1, boost::mpl::_2 >
Gives me the following error (and three more):
class "boost::mpl::arg<1>" has no member "tag"
: begin_traits< typename BOOST_MPL_AUX_SEQUENCE_TAG(Sequence) >
instantiation of class "boost::mpl::begin<Sequence> [with
Sequence=boost::mpl::_1]" at line 64 of
instantiation of class "boost::mpl::find_if<Sequence, Predicate> [with
Sequence=boost::mpl::_1, Predicate=boost::mpl::same_as<boost::mpl::_2>]" at
line 33 of "C:\Development\Library\boost_1_28_0\boost/mpl/find.hpp"
instantiation of class "boost::mpl::find<Sequence, T> [with
Sequence=boost::mpl::_1, T=boost::mpl::_2]" at line 37 of
instantiation of class "boost::mpl::contains<Sequence, T> [with
Sequence=boost::mpl::_1, T=boost::mpl::_2]" at line 56 of
instantiation of class "boost::mpl::if_<C, T1, T2> [with
C=boost::mpl::contains<boost::mpl::_1, boost::mpl::_2>, T1=boost::mpl::_1,
T2=boost::mpl::push_front<boost::mpl::_1, boost::mpl::_2>]" at line 54 of
(Sorry for the mess)
All in all, great work! Can't wait for the Boost 1.29 release.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk