这段代码:
#include <iostream>
#include <string>
std::pair<std::initializer_list<std::string>, int> groups{ { "A", "B" }, 0 };
int main()
{
for (const auto& i : groups.first)
{
std::cout << i << '\n';
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
编译但返回段错误。为什么?
在 gcc 8.3.0 和在线编译器上测试。