/* File : example.h */ #include #include template std::map half_map(const std::map& v) { typedef typename std::map::const_iterator iter; std::map w; for (iter i = v.begin(); i != v.end(); ++i) { w[i->first] = (i->second)/2; } return w; }