2D Vector in C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rakeshkreddy
    New Member
    • Feb 2010
    • 1

    #1

    2D Vector in C++

    I have created a 2 D Vector in the following manner :

    vector<vector<s tring> > items ( 5, vector<string> ( 5 ) );

    If I want to insert a string value at location [0][2], I can do it this way :

    items[0][2] = "Hi";

    But if I want to use the built in methods like insert() , how can I achieve the same ?

    Please help. Illustration with an example will help.

    Thanks
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    items[0] is a vector, right? You should be able to insert() into that vector.

    Comment

    Working...