Boost logo

Boost Users :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2004-02-15 17:56:03


Martin Wartens wrote:
> Hi,
> is there a way to unroll a loop with mpl? I simply would like to
> unroll
>
> for (int i=0; i<10; i++)
> foobar(i);

Sure,

    mpl::for_each< mpl::range_c<int,0,10> >(
          boost::bind(&foobar, _1)
        );

> MPL looks like it is quite powerful, but what is it worth when there
> is no useful documentation? There are hardly any examples, the
> mini-tutorial is indeed very mini.

FWIW, the reference docs (http://tinyurl.com/2baba) are full of
examples -- in fact, there is one per each documented component. A
valid criticism would be that they are not complete -- e.g. the very
'for_each' template is documented only in the paper. The latter is
going to get fixed Real Soon.

--
Aleksey Gurtovoy
MetaCommunications Engineering

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net