In my application I have the following requirements -
The data structure will be populated just once with some values (not key/value pairs). The values may be r
If building of the data-structure does not factor into the performance-concerns (or at least only marginally), consider saving your data into a std::vector
: There's nothing beating it.
For speeding up the initial building of the data-structure, you might first insert into a std::unordered_set
or at least use one for checking existence before insertion.
In the second case it need not contain the elements, but could contain e.g. indices.
std::vector v;
auto h = [&v](size_t i){return std::hash()(v[i]);};
auto c = [&v](size_t a, size_t b){return v[a] == v[b];};
std::unordered_set tester(0, h, c);