One can get an element from std::tuple by index using std::get.
Analogically, how to set tuple’s element by index?
One can get an element from std::tuple by index using std::get . Analogically, how
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
std::getreturns a reference to the value. So you set the value like this:This of course assumes that
myTupleis non-const. You can even move items out of a tuple viastd::move, by invoking it on the tuple: