What is the best way to add something to the nested vector of a multidimensional vector...I already have ints inside, lets say VECNAME[rowone][columntwo]...How can I add to columntwo???

Recommended Answers

All 4 Replies

Is it a 2D vector or is there another vector at each of the positions(like a 3D)? Perhaps a small piece of the code would be helpful.

Sorry it is 2D...

vector<int> numbs;
vector< vector<int> > HORIZLINE;

Just use the matrix notation. I assume you have numbs added to the HORIZLINE. Say you add 1 more vector<int> called numbs2. So to add onto numbs you can say HORIZLINE[0].push_back(whatever); and to add to numbs2 you'd say HORIZLINE[1].push_back(whatever); . I think I'm interpreting your question correctly.

Right, I had been doing that but I didnt think it worked...However, after you posted I created a sample program using that principle in a simple main function and it worked so it must have been something else I was doing wrong, thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.