The cppreference page for "if" statement;
https://en.cppreference.com/w/cpp/language/if
gives the following example;
Except that names declared by the init-statement (if init-statement is a declaration) and names declared by condition (if condition is a declaration) are in the same scope, which is also the scope of both statements Blockquote
std::map<int, std::string> m;
if (auto it = m.find(10); it != m.end()) { return it->size(); }
Thats a typo, isn't it? I'm not missing anything here am I, it should be;
it->second.size();
or
it->first;
No?