Boost logo

Boost :

Subject: Re: [boost] boost::mpl::for_each and value_initialized
From: Domagoj Saric (dsaritz_at_[hidden])
Date: 2009-10-27 19:37:49


>> typedef mpl::range_c<int,0,10> numbers;
>> std::vector<int> v;
>> mpl::for_each<numbers,mpl::_>(
>> boost::bind(push_back, &v, _1)
>> );
>
> true this does actually compile and work...but i still don't understand how
> :) because (as far as i understand) mpl::for_each feeds mpl::int_ objects not
> POD ints to the functor (created with bind) in the above case and the functor
> expects and accepts only POD ints (not mpl::int_s)...

just to sort answer my self publicly in case someone else wondered the same
thing/managed not to see it clearly stated in the documentation: that mpl
integral constants provide implicit conversion operators...

-- 
 "That men do not learn very much from the lessons of history is the most
important of all the lessons of history."
 Aldous Huxley 

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