> I was wandering is linked list the best solution?
There isn't a "best" solution as such, there are many tradeoffs to be considered. Some of which are not so obvious.
Well the search/replace is going to be expensive on larger lists, but that has to be weighed against the extra complexity of something like std::map.
Are you only interested in the head of the list, or in the whole of the list?
How many times do you process the list compared to modifying the list?
Like do you scan it 100 times and change it once?
As it stands, I might go with a std::map to permit easy lookup and changing of values, and also maintain a std::list through the map to indicate the change order.
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Offline 7,164 posts
since Dec 2005