Checking number of elements

suggest change

The container std::map has a member function empty(), which returns true or false, depending on whether the map is empty or not. The member function size() returns the number of element stored in a std::map container:

std::map<std::string , int> rank {{"", 1} ,{"", 2}, {"", 3}};
    std::cout << "Number of elements in the rank map: " << rank.size() << std::endl;
} else {
    std::cout << "The rank map is empty" << std::endl;

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents