Boost logo

Boost Users :

From: Thorsten Ottosen (tottosen_at_[hidden])
Date: 2006-01-16 17:57:08


Eric Niebler wrote:
> Thorsten Ottosen wrote:
>
>>Eric Niebler wrote:

>>>Not sure what you're referring to. Boost.Foreach does no such
>>>rvalue-to-lvalue cast.
>>
>>So this wouldn't compile:
>>
>>vector<int> foo();
>>...
>>BOOST_FOREACH( int& r, foo() )
>> ++r
>>
>>?
>
>
>
> No, it doesn't compile, and it shouldn't. What would be the point of
> mutating the unnamed temporary vector returned by foo()?

I would probably be efficiency. Assume it was a vector of strings and
that you had to append "_" to each of the strings and then pass the
string to some other function.

Or maybe I wanted to do the following:

foo::copy( foo::unique( boost::as_mutable( foo() ) ), some_where );

-Thorsten


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