Search code examples
c++arraysinitializationdeclarationdeque

Confusing syntax of deque. What does this syntax mean?


I have a C++ code for deque which declares the deque and I do not understand what it means?

deque<int> pile[7];

The above deque used is from standard library implementation of C++ I did an extensive research on it but no body has used it this way. I don't know if this is

  1. "deque of deques" or
  2. "deque of arrays" or
  3. "arrays of deque"

Kindly please explain?


Solution

  • For any type T, T[N] denotes an array of N elements of type T.

    You have T pile[7] with T = deque<int>, so pile is an array of seven deques.