/* File : example.h */ #include #include #include #include double average(std::vector v) { return std::accumulate(v.begin(),v.end(),0.0)/v.size(); } std::vector half(const std::vector& v) { std::vector w(v); for (unsigned int i=0; i& v) { // would you believe this is the same as the above? std::transform(v.begin(),v.end(),v.begin(), std::bind2nd(std::divides(),2.0)); }