Use for (auto& [key, val] : m) to loop through all key-value pairs with structured bindings. Entries appear in sorted key order, smallest to largest. You can modify values through the reference: val++ updates the actual map entry.
Keys are const because changing them would break the sorted ordering that the map maintains. For read-only access, use for (const auto& [key, val] : m) instead. This prevents accidental modifications and may allow compiler optimizations for better performance.