I am initializing a map map ex; in C++. I could not find contains_key or similar function in stl, hence I am just using ex[inputString]+
map ex;
ex[inputString]+
Yes, values that do not exist when accessed with operator[] are default-constructed. For numeric values, this is 0.
operator[]
That said, you're looking for the count method:
count
bool hasElement = ex.count("element");