Skip to content

Typo in Appendix A: Intermediate C++ Review #41

Open
@zixin96

Description

@zixin96
// Get an iterator to the element with the key 2
std::map<int, std::string> iter = months.find(2);  // SHOULD BE std::map<int, std::string>::iterator iter = months.find(2);  
if (iter != months.end()) // This is only true if found
{
   std::cout << iter->first << std::endl; // Outputs 2
   std::cout << iter->second << std::endl; // Outputs February
}

I find this in my kindle version of the book, however, I can't seem to find page number anywhere.
Thanks for the great book!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions