这可能有一个非常简单的答案,但我真的想不出来。为什么我做这个会出错?如何正确地初始化这样的东西?
std::array<std::tuple<int, std::string>, 3> tuples{
{3, "a"},
{7, "b"},
{2, "c"}
};
在 MSVC 2015 上,我收到以下错误:
No suitable constructor exists to convert from "int" to "std::tuple<int, std::string>"
No suitable constructor exists to convert from "const char[2]" to "std::tuple<int, std::string>"
pair
,因为你当前的类型只有两个成员。 - Nicol Bolas