I have this piece of code.
std::vector<int> aVector;
int anArray[2];
unsigned anArraySize = sizeof(anArray) / sizeof(int);
for (unsigned int j = 0; j < 100; j += 10) {
for (unsigned int i = 0; i < 100; i += 3) {
anArray[0] = j;
anArray[1] = i;
aVector.insert(aVector.end(), &anArray[0], &anArray[anArraySize]);
}
}
It is basically inserting an array of size two(0, 1) into the vector called ijVector.
Now, I would like to access the anArray values in anArray[0] and anArray[1] for each value in aVector.
For example, something like
for (int i = 0; i --> aVector.size() - 1;) {
std::cout << "aVector[" << i << "].anArray[0] = " << aVector.anArray[0] << std::endl; // getting value is wrong
std::cout << "aVector[" << i << "].anArray[1] = " << aVector.anArray[1] << std::endl; // getting value is wrong
}
How do I get the value inside array of each vector?