[CSI] vector of arrays

Mikhail Nesterenko mikhail at cs.kent.edu
Tue Nov 26 15:37:16 EST 2019


CSI students,

vector of arrays is not allowed in C++. That is:

  vector<int[3]> vectorOfArrays;

is prohibited. The reason is that arrays cannot be copied, which is
required for vector maintenance (such as enlarging or shrinking of a
vector).

There is however, an array container, which is similar to raw arrays:
it cannot change its size. So, this works:

   vector<array<int,3>> vectorOfArrays;

Thanks,
-- 
Mikhail


More information about the cs13001 mailing list