Template Function otyca::operator+=
Function Documentation
-
template<typename T>
void otyca::operator+=(std::vector<T> &v1, const std::vector<T> &v2) Adds the elements of one vector to another.
This function applies the addition assignment operator (
+=
) to each element of the first vector, adding the corresponding element of the second vector to it. The vectors must have the same size for the operation to be performed.Note
This function modifies the vector
v1
in place. If the vectorsv1
andv2
have different sizes, the operation is not performed, and the function returns immediately.- Template Parameters:
T – The type of elements in the vectors.
- Parameters:
v1 – The first vector, whose elements will be modified by addition.
v2 – The second vector, whose elements will be added to
v1
.