-2

Assume this declaration:

#include <vector>
typedef int int2[2]; // pair of integers
typedef std::vector<int2> vi2; // vector of integer pairs

Now, this vi2 is not really usable. You cannot resize or add items to it. Why is this not allowed?.. (Obviously to fix it int2 would need to be wrapped in a struct or a pair, but this is irrelevant).

Pavel P
  • 15,789
  • 11
  • 79
  • 128

1 Answers1

2

Arrays in C++ are not copyable or assignable, both of which are requirements for elements of vectors.