|
Boost : |
Subject: Re: [boost] [assignment] += for containers on right side
From: Lars Viklund (zao_at_[hidden])
Date: 2012-07-20 11:43:16
On Thu, Jul 19, 2012 at 06:00:42PM +0200, Jochen Wilhelmy wrote:
> Hi!
>
> is it possible to make += also work for containers on right side?
> i.e.
> int a;
> std::vector<int> b;
> std::list<int> c;
> std::vector<int> d;
> d += a,b,c,d;
I would rather not have such a functionality, at least not without extra
spelling around it. At a very minimum I'd expect some kind of
d += a,expand_range(b),expand_range(c);
or
d += a,expand_ranges(b,c);
or
d += flatten(a,b,c);
What if you have code that relies on an implicit conversion from those
container types to the element type of the left hand side. You would
suddenly and silently change the semantics of such code.
Beware changes of semantics, because you _will_ have people that
wittingly or unwittingly rely on them.
-- Lars Viklund | zao_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk