First off, yes I'm new to C++ vectors.
Now my question is, why do you think my vector is empty?
I have a global variable:
vector<int> parentVector;
Now, since it's a global variable, and I don't know what size should it be, only later into the program, I do this at some point:
//numberOfNodes = 8 in current example
parentVector.reserve(numberOfNodes);
And a little later, I try to assign a value to the first element of the vector, but it doesn't work:
parentVector[0] = -1;
And I also do the following, which doesn't assign any value either:
//nextNode.node and currentNode.node is between the range of 1 - 8, thus the - 1.
parentVector[nextNode.node - 1] = currentNode.node - 1;
Edit: Thank you for your answers, resize() worked.