C++ Container with Fastest "Exists" Seeking (Vector/Array/etc) -


i'm not sure best c++ data container use here.... i'm building application that's sensitive latency (so need absolute fastest implementation).

i need store 300,000 strings one-time (only 1 write), frequent checks if element exists in data store (many reads). never need else data set except check if value exists within it, , i'll need check hundreds of times per second. if matters, majority of lookups result in key not being found.

i've considered using vector or array, seem scan through entire list , inspect value one-to-one... work... since we're indexing strings, isn't there data container builds kind of tree index values, when searching value "apple", it'll first @ keys beginning "a", next character "p", , when doesn't find "ap..." returns not found. me seems it'd faster searching entire massive set each time. i'm hoping native container has kind of functionality.

this project have boost compiled in, if helps.

thanks much!

with boost, answer boost::unordered_set.

it's available part of standard in c++11 std::unordered_set in <unordered_set>.

they're both built on hash table, it's o(1) lookup once hash computed.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -