Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-04-12 19:50:51

"Brian McNamara" <lorgon_at_[hidden]> wrote in message
> What's an example use-case? I don't recall ever needing/wanting this.

My initial use-case was to use it in mutating container algorithms. Without
you would have to create a temporary, even though you didn't need it (and
hardcoding the return-type
is messy). So it would have been
optimal just to hand the result of function to new functions even though
they mutate, eg

vector<int> vec();

my_copy( my_sort( my_unique( vec() ) ), ostream_iterator<int>( cout ) );

instead of

vector<int> temp1( vec() );
vector<int> temp2( my_unique( temp1 ) );
my_copy( my_sort( temp2 ), .... )



Boost list run by bdawes at, gregod at, cpdaniel at, john at