How do I implement this using std::transform
and std::foreach
? (without C++11)
std::vector<double> exp_c(const std::vector<double>& x) {
const int n = x.size();
std::vector<double> y(n);
for (int i = 0; i < n; i++) {
y[i] = std::exp(x[i]);
}
return y;
}
Thanks.