|
From: <h.r...@gm...> - 2002-09-04 22:20:27
|
Hi list,
i want to replace the following code:
typedef vector<double>::iterator it;
for(it i = TMW.begin(); i != TMW.end(); i++) {
sx += *i;
sxx += sqr(*i);
}
with
sx = accumulate(TMW.begin(), TMW.end(), 0.0);
sxx = accumulate(TMW.begin(), TMW.end(), 0.0, sqr);
[...]
def of sqr:
template<class T>
inline T sqr(T x) { return x * x; }
but sxx = .... does not compile.
The error message:
55 E:\dev\dev-c++\proj2\procabi.cpp
no matching function for call to `accumulate (double *, double *, double,
{unknown type})'
Why that ???
Thanks in advance
greetings
Horst
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
|