for each support ?
#7425
-
int main()
{
map<string, int> mymap;
mymap["surrender"] = 1;
for (auto [key, value] : mymap)
{
cout << key << "---" << value << endl;
}
return 0;
} Can compile successfully but prompt undefined identifier |
Beta Was this translation helpful? Give feedback.
Answered by
Colengms
Apr 26, 2021
Replies: 1 comment 1 reply
-
Hi @Another7 . I do not get errors with the following code: #include <iostream>
#include <string>
#include <map>
using namespace std;
int main()
{
map<string, int> mymap;
mymap["surrender"] = 1;
for (auto [key, value] : mymap)
{
cout << key << "---" << value << endl;
}
return 0;
} I suspect you will need to provide a |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Another7
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @Another7 . I do not get errors with the following code:
I suspect you will need to provide a
cppStandard
setting ofc++17
orc++20
, for this code to be considered valid. If you have not setcppStandard
, it would be the default used by the specified or detected compiler, which likely is notc++17
orc++20
.