Boost logo

Boost :

Subject: Re: [boost] [assignment] += for containers on right side
From: Jochen Wilhelmy (jochen.wilhelmy_at_[hidden])
Date: 2012-07-20 09:55:51


Am 20.07.2012 15:19, schrieb Thorsten Ottosen:
> On 19-07-2012 18:00, Jochen Wilhelmy wrote:
>> Hi!
>>
>> is it possible to make += also work for containers on right side?
>
> Many things are possible in C++.
then why not do it ? ;-)
>
>> i.e.
>> int a;
>> std::vector<int> b;
>> std::list<int> c;
>> std::vector<int> d;
>> d += a,b,c,d;
>>
>> this would be similar to strings where += at least works with one string
>> on the right side.
>
> You could maybe do
>
> push_back( d ).range( a ).range( b ).range( c ).range( d );
i'm after having to write only +=
of course i can write insead of d += 1,2,3,4;
d.push_back(1);d.push_back(2);d.push_back(3);d.push_back(4);

-Jochen


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