Use map::find and map::end:
map::find
map::end
if (m.find("f") == m.end()) { // not found} else { // found}