PDA

View Full Version : Exists any method to move data into STL::MAPS ???



tonnot
18th April 2011, 16:40
I'd want a method to 'move' map data (data or blocks of data ):

I' d like a function like this :
map_move origin, numberof rows , new_pos
When I use this function I have a new empty space at a known position.

I have :

map[0][0 to n]
map[1][0 to n]
map [2][0 to n ]

I want to insert a new value at 1, so I want :

map[0][0 to n] old map 0
map[1][0 to n] empty new data
map [2][0 to n ] (old map 1
map [3][0 to n ] (old map 2

Is there something like this ? Thanks

high_flyer
18th April 2011, 16:44
based on your example you don't need a map but a set, list or vector.
Map is key based, and if you insert an entry for an already existing key, the entry will be overwritten.
Based on your example you need index based container not a key based one.

tonnot
18th April 2011, 17:22
Thank you very much !