I have a std::vector as described below:
std::vector<std::pair<int, const char*>> matrix;
This vector has the following values (for e.g.): values (as an example)
These values can be access here as follows:
matrix[0] = [0,Hello] // pseudo code (only showing values inside)
matrix[1] = [0,Fox] // pseudo code (only showing values inside)
matrix[2] = [1,Red] // pseudo code (only showing values inside)
I am iterating through the contents of the vector read the values, by doing this:
for (std::vector<std::pair<int, const char*>>::iterator it = matrix.begin(); it != matrix.end(); ++it)
{
std::pair<int, const char*> v_temp = *it;
std::cout << v_temp.first;
std::cout << v_temp.second;
}
Now, what this is doing is iterating from the first element of vector to the end element of the vector. What I want to do, is iterate only on the first elements (i.e. int values). So, from the tabular image I have attached, this current code will loop for [ row x column ] [ 9 x 2] = 18 times. What I want it for it to iterate only 9 times [ rows ] and not consider columns at-all.
How can I do that?