er wrote:
i'm trying to implement x*=y or x+=y; where x and y are containers
and *= and += are element wise i.e. x*=y is meant as
x[1]*=y[1],...,x[n]*=y[n] and likewise for +=;
i'm wondering if
a) there exists a function already defined for this purpose for the
types that i intend it for (see below)
You mean, like 'std::for_each'?
b) is there a way to make * or + a parameter so that i don't have to
write two (nearly identical) pieces of code for each (see below).
Probably. See 'std::plus' and 'std::multiplies'...
c) more generally, is there a better way to do this?
You mean, like using 'valarray', for example?
[..]
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask