How to access the vector of vectors in cpp. |
That's extremely vague, so it's hard to know what you're really asking.
A vector of vectors is still just a vector. You access it in exactly the same way as any other vector, using the same interface.
Each element of that vector is itself also a vector. You can access those elements in exactly the same way as any other vector.
If you're finding the syntax confusing, see the advice I gave you in your other thread for using typedefs to help simplify the code.
Without a more specific question, it's hard to give a more specific answer.
And the loop is running infinitely. |
Presumably, that's because the condition
it != m[i].end()
is never false.
This is where you should use your debugger to step through the code to find out why that's happening.
How to make it run only once for the given condition. |
What does that mean?
Or is there a way to access the vector of vectors without using for loop? |
All the standard library features for operating on a vector will work on a vector of vectors. For example, stuff in
<algorithm> like
std::tranform will work.