
std::valarray provides this type of functionality. If you need to use a vector, you can write your own operator overload: template<class T> std::vector<T> & operator += (std::vector<T> & l, int r) { std::for_each(l.begin(), l.end(), [r] (T & t) { t += r; }); return l; } Hope this helps. ________________________________ From: Kai Schroeder <kaischroeder3@googlemail.com> To: boost@lists.boost.org Sent: Friday, July 20, 2012 3:38 PM Subject: Re: [boost] [assignment] += for containers on right side Hi Digi, as far as I know there is no such functionality in Boost. To implement this I would take inspirations from boost::assign and make use of boost::range. Regards, Kai On 7/19/12, Jochen Wilhelmy <jochen.wilhelmy@googlemail.com> 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;
this would be similar to strings where += at least works with one string on the right side.
-Jochen
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost