Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2004-02-23 06:59:02


Gennadiy Rozental wrote:
> > mpl::for_each<mpl::transform<s, wrap<_1> >::type>(foo());
>
> I saw this in mpl::for_each test.

Actually, if you do it as in the test, it's even simpler:

    mpl::for_each< types,wrap<_1> >(foo());

> It may probably solve my problem. But is tyhe more generic solution?

Sorry, cannot parse this one.

> Or why doesn't for each pach mpl::identity in a first place?

Sometimes the value semantics is exactly what you want:

    typedef mpl::range_c<int,0,10> numbers;
    std::vector<int> v;
    mpl::for_each<numbers,mpl::_>(
          boost::bind(push_back, &v, _1)
        );

> Or could we eliminate parameter at all and make for_each to
> work with explicit type specialization, like this:
>
> aux::unwrap(f, 0)::operator()<arg>();

Like the previous suggestion, it would rule out ordinary function
objects; besides, it's not portable.

--
Aleksey Gurtovoy
MetaCommunications Engineering

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk