Boost logo

Boost :

Subject: Re: [boost] boost::mpl::for_each and value_initialized
From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2009-09-04 05:11:54


On Wed, 02 Sep 2009 04:11:12 -0500, Domagoj Saric
<domagoj.saric_at_[hidden]> wrote:
> there was a somewhat related discussion (
> http://lists.boost.org/Archives/boost/2004/02/61582.php ) dealing, among
> other things, with the problem of default construction in mpl::for_each
> ...
> in the current implementation you must either pay for default
> construction
> or pay for added verbosity/ugliness of the "wrap" approach...
> ...i must admit i did not quite understand the argument of Aleksey
> Gurtovoy
> that the proposed "aux::unwrap(f, 0)::operator()<arg>()" solution would
> "would rule out ordinary function objects" (can you even use them with
> mpl::for_each?)

Yep. I provided an example in the message you are referring to
above:

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

> and that "it's not portable" (the ::operator()<arg>() syntax
> is not standard?)...

Standard != portable in practice.

-- 
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