You should read the documentation for std :: tie
Creates a tuple of lvalue references to its arguments [...]
therefore, in addition to using a tuple to “unpack” a tuple into variables, just like you, you can also use it as follows
int rno = 10; string name; int marks;
tuple <int&, string&, int&> x = tie(rno, name, marks);
get<0>(x) = 42;
cout << rno;
"" -, lvalue.
utnapistim ( ) , "", - -
struct comparable {
int a, b;
bool operator==(const comparable& x) {
return std::tie(a, b) == std::tie(x.a, x,b);
}
};