c++ - Data structure for sorting/retrieval strings -


i have multiple arrays of strings, used comparison function sort them in priority queue. overlooked fact need iterate through strings..

what other data structure recommend? perhaps allows comparison function sorted set of strings

i pop elements priority queue means need auxiliary space before pushing them onto priority queue

it ideal if vector allows comparison function. stl "set" work? have fixed number of elements (about 450).

edit: confirming stl's set working.. without defining own comparison function strings.

a set work, make vector, reserve enough capacity, , use sorted inserts using lower_bound. since strings cheap swap, should fine (and in case 450 tiny number).

a vector has constant-time lookup , random access, if don't need insert , erase lot, it's better choice.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -