search for: halve_in_place

Displaying 1 result from an estimated 1 matches for "halve_in_place".

2008 Nov 06
2
Fwd: SWIG with R and C++ STL
...v) { return std::accumulate(v.begin(),v.end(),0.0)/v.size(); } std::vector<double> half(const std::vector<double>& v) { std::vector<double> w(v); for (unsigned int i=0; i<w.size(); i++) w[i] /= 2.0; return w; } void halve_in_place(std::vector<double>& v) { std::transform(v.begin(),v.end(),v.begin(), std::bind2nd(std::divides<double>(),2.0)); } ------------------------------------- Basicly they are just examples from the SWIG doc. And I ran: *swig -c++ -r -o myvector_wrap.cp...