i_use_the_internet
i_use_the_internet

Reputation: 614

C++ Setting std::tuple values in an std::unordered_map

I have an unordered map with string keys and a tuple of three strings and one int. How can I access the individual tuples to set them.

Given:

std::unordered_map<string,std::tuple<string, string, string,int>> foo_data_by_username;

How can I set the individual tuple values of say foo_data_by_username[some_user];

Upvotes: 1

Views: 1026

Answers (1)

Brian Rodriguez
Brian Rodriguez

Reputation: 4359

std::get<0>(foo_data_by_username[some_user]) = "new string";

Where 0 is whichever index of the tuple you're interested in.

Upvotes: 6

Related Questions