From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-06-26 08:17:01
Andrei Alexandrescu wrote:
> STL does reduce the amount of code you write quite
> drastically, and it would be hard to convince me
> otherwise because I know that from direct and
> extensive experience. But why compare mpl with stl
> instead of concretely discussing on mpl as it stands.
May be because there is a direct relationship between these two libraries?
Here's how I would write a code that finds the element of maximum size in a
sequence using (extended) STL facilities (something we use here at work):
long size_of(something const&);
long max_size = *stl::max_element(
Here is a compile-time equivalent of the above implemented with MPL:
typedef mpl::list4<int,char,char,double> types;
mpl::transformed_seq< types, mpl::size_of<_> >
BOOST_STATIC_ASSERT(max_size::value == 50);
Does it ring a bell?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk