I encountered the following problem:
After I erase a key and a call the key once again from the map, it always returns 0.
So what if the value of a certain key was set to 0?
#include <iostream>
#include <map>
int main(int argc, char const *argv[]) {
std::map<std::string, int> mymap;
mymap["a"] = 10;
mymap["c"] = 10;
mymap["b"] = 20;
mymap["zero"] = 0;
if (mymap["zero"])
std::cout << "yes" << '\n';
else
std::cout << "no" << '\n
mymap.erase("zero");
if (mymap["zero"])
std::cout << "yes" << '\n';
else
std::cout << "no" << '\n';
std::cout << mymap["zero"] << '\n';
return 0;
}