8

I read a piece of code from a book but I do not really understand the grammar,

const auto& [local_min, local_max] = minmax(A[i], A[i+1]);

where A is vector of int and local_min and local_max are int.

I know minmax returns a pair, but what does the square brackets do, i.e. [local_min, local_max]? I guess it is not for arrays here.

Thanks.

Sean
  • 2,649
  • 3
  • 21
  • 27

0 Answers0