What’s wrong with this definition when using a pre-C++11 compiler?

Advertisement

std::vector<std::vector<int>> thematrix;

  • There’s nothing wrong with it.
  • An std::vector cannot contain more std::vector containers as its elements.
  • The correct syntax should be: std::vector[std::vector[int]] thematrix;
  • >> is parsed as the shift-right operator, and thus results in a compile error.
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment


Share via
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend