C
claire.bell1
Hi,
Im having lots of problems trying to implement a vector of arrays in C++.
Im trying to make a vector that will hold coordinates. Ive decided to
implement a coordinate as an array of integers of length 2.
My code to initialise this array is:
vector<int[2]> coordVector;
This seems to compile ok but im not sure if it is making a vector of arrays
because the command:
coordVector.push_back({0,0}) does not work.
Im sure im just doing something simple wrong but im having a nightmare
trying to fix it. Does anyone have any example code that uses a vector of
arrays that i could look at?
Thanks,
Vipa.
Im having lots of problems trying to implement a vector of arrays in C++.
Im trying to make a vector that will hold coordinates. Ive decided to
implement a coordinate as an array of integers of length 2.
My code to initialise this array is:
vector<int[2]> coordVector;
This seems to compile ok but im not sure if it is making a vector of arrays
because the command:
coordVector.push_back({0,0}) does not work.
Im sure im just doing something simple wrong but im having a nightmare
trying to fix it. Does anyone have any example code that uses a vector of
arrays that i could look at?
Thanks,
Vipa.