I am using std::tie
to initialize some variables from a tuple like this:
int a1, a2;
std::tie(a1, a2) = tupleA;
I am wondering if it is possible to do that with multiple tuples without repeating std::tie
, something along these lines:
int a1, a2, b1, b2;
std::tie(a1, a2) = tupleA,
(b1, b2) = tupleB;
The above code does not compile. I want to have the following without repeating std::tie
:
int a1, a2, b1, b2;
std::tie(a1, a2) = tupleA;
std::tie(b1, b2) = tupleB;
Other types
If I wanted to do the same with int
as an example, I could easily do it:
int a = 1,
b = 3;
I do not need to write int b
; b
alone is sufficient.
Is there any way to do this with std::tie
?
Aucun commentaire:
Enregistrer un commentaire