I have a vector of tuples vector<tuple<int,int>> vector; and I want to modify one of the tuples it contains.
for (std::tuple<int, int> tup : std::vector)
{
if (get<0>(tup) == k)
{
/* change get<1>(tup) to a new value
* and have that change shown in the vector
*/
}
}
I am unsure how to change the value of the tuple and have the change be reflected in the vector. I have tried using
get<1>(tup) = v;
but that doesn't change the value of the tuple that is in the vector. How can I do this? Thanks.
Aucun commentaire:
Enregistrer un commentaire