Why there is no + = operator for vectors in stl

I am curious? What high logic fundu is behind implementation:

result+=vector1;

where both the results and vector1 are stl vectors.

Note: I know how to implement this bit, but I need to know what logic was used by the sages who developed the STL when they decided not to implement this function?

+3
source share
4 answers

What do you expect to resultcontain, the result of concatenating the source resultwith vector1or elementary +=(whatever that means for the base types), perhaps the default initialization elements if the sizes do not match?

And yes, this is the answer;).

, .

, valarray , vector - .

+17

, , . ? result.insert( result.end(), vector1.begin(), vector1.end() ) .

+3

( , ) , , . , . , - , .

, . 6 ( , "" - ). :

: ( ), (a ), (a ) ().

, , , - , ( "" ) , .

, , , ( ). STL . -, (, , ), .

+2
0

Source: https://habr.com/ru/post/1737950/


All Articles