如果我有一个元素数量不确定的向量,如何在cpp中从中创建一个元组?以下将把向量作为一个整体保存在元组中,但不保存其元素。
vector vec{1,2,3};
auto returnTuple = std::make_tuple(vec);
//cout << get<0>(returnTuple) //fail, as get<0>(returnTuple) is vec;
cout <<get<0>(returnTuple)[0] //work, 1
// What I want here is get<0>(returnTuple) is 1;