Let's say we have a std::queue<std::pair<int, int> >
.
To extract a pair, we can either do:
int r = q.front().first;
int c = q.front().second;
or
auto [rr, cc] = q.front();
where rr
and cc
can then be treated as regular int
.
I've never encountered this type of syntax before. What does the standard say about it? What is the auto
specifier extracting?
auto p = q.front();
would just be a regular std::pair
.