3

In python, we can assign multiple variables from an iterable. Like this

timeA = (10, 45, 11)
hrs, min, sec = timeA

Is there a way to do this in C++ with vectors, or any container(like std::pair) for that matter.

Expected this to work, but it did not.

vector<int> timeA {10, 45, 11};
int hrs, min, sec;
{hrs, min, sec} = timeA;
silentPlanet
  • 341
  • 2
  • 9

0 Answers0