Code:
void call(function<void ()> f) {
f();
}
void end() {
cout << "End..." << endl;
}
void fn(map<string, string> &m, map<string, string>::iterator i) {
cout << "i->first: " << i->first << endl;
if (++i == m.end()) {
end();
} else {
call(bind(&fn, m, i));
}
}
int main() {
map<string, string> m;
m["abc"] = "asasd";
m["bcd"] = "sasas";
m["cde"] = "jdssd";
call(bind(&fn, m, m.begin()));
}
Comment