I have a vector<my_structure>. my_structure has an unique id int identifier.
I have :
vector.at(0).id=1;
vector.at(1).id=134;
....
vector.at(200).id=25478;
I use this vector to add, insert, etc...
Now, I need the fastest method to access the data by its id , so I need a method to know that is 25478 is stored at pos 200 .
I could to use a find iterator or maybe to construct a previous 'map' .
What can be the ideal-faster container or method, knowing that I only need to use it as a 'id' finder, not for add or insert or delete data.????
This vector store pen-styles for drawing. For every line I'm going to draw I have to know its style ( by the id ). I'm going to have 'worlds' with more than 100.000 lines.....
Any idea ? Thanks.
Bookmarks