$\require{cancel}$
#include <map>
map<indexType, valueType> id
#include <algorithm>
mapVar[indexType] = valueType
if (mapVar.find(indexType) == end(mapVar)) {
.size() does what you want.
for (auto x : map) {
//x.first is the index
//x.second is the data
cout << "map[ " << x.first <<"] = " << x.second;
}