Template Function otyca::operator-=
Function Documentation
-
template<typename T>
void otyca::operator-=(std::vector<T> &v1, const std::vector<T> &v2) Subtracts the elements of one vector from another.
This function applies the subtraction assignment operator (
-=
) to each element of the first vector, subtracting the corresponding element of the second vector from 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 subtraction.
v2 – The second vector, whose elements will be subtracted from
v1
.