vendredi 26 juin 2020

Using [][] operator with vectors?

I have created a one dimensional vector of int, how may I treat it like 2 dimensional one?

While I can write arr[1]; I can't write arr[1][2];

Why I need this: Instead of defining a vector of vectors [3x5] I defined a vector whose length is 15, so every time I have a function that takes coordinations of a place in matrix I have to call another function which converts those into one dimensional value, which is really annoying.

Aucun commentaire:

Enregistrer un commentaire