简体   繁体   English

C ++在std :: unordered_map中设置std :: tuple值

[英]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]; 如何设置单个的元组值,例如foo_data_by_username[some_user];

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

其中0是您感兴趣的元组的索引。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM