So I am working with some multidimensional vectors in C++ in NetBeans, and whenever I try to call the .size()
method, NetBeans marks it in red and says "Unable to resolve identifier size.". However, it does recognise other vector methods such as .push_back()
. The code compiles well though...
Here is my code:
#include <vector>
using namespace std;
typedef vector<int> int1D;
typedef vector<int1D> int2D;
int2D populate (int2D arg1, int arg2);
int main () {
//Do stuff...
}
int2D populate (int2D grid, int gridSize) {
int2D my_2d_array;
//Here I fill my_2d_array...
for (int x = 0; x < gridSize; x++) {
for (int y = 0; y < gridSize; y++) {
int value = grid[x][y];
if (value == 0) {
//get all coordinaes of values with 0
int1D coordinates;
coordinates.push_back(x);
coordinates.push_back(y);
my_2d_array.push_back(coordinates);
}
}
}
for (int x = 0; x < my_2d_array.size(); x++) {
//do something
}
}
Here is a screenshot of the error highlighting: