Is it possible to iterate over all of the values in a std::map using just a "foreach"?
std::map
This is my current code:
From C++1z/17, you can use structured bindings:
#include #include #include int main() { std::map m; m[1] = "first"; m[2] = "second"; m[3] = "third"; for (const auto & [key, value] : m) std::cout << value << std::endl; }