#### Topic: QSet, speed of search of the container

In one of algorithms we have keys, keys it is the integer numbers, each new key should be unique, therefore for assignment of a new key the global counter on 1 simply increases. In the course of operation some keys appear are remote, as a result there is a set of integer numbers from a range [1, 32000] (for example) which really are present not all (for example from them only 1000 numbers really is). It is necessary to sort out all these numbers. We added all of them in QSet <int> (hash-set) then search organized one of two methods: QSet <int> indices =...; for (int i = 0; i <32000; ++ i) {if (indices.contains (i)) {int corrent_index = i;//some code}} the second method: QSet <int> indices =...; for (QSet <int>:: iterator it = indices.begin (); it! = indices.end (); ++ it) {int corrent_index = *it;//some code} it would Seem, in the second a variant we have a smaller cycle in 20 times. However time samplings show that the second cycle on time more than in 2 times more slowly the first. It QSet <int> such slow? Or I not so made something? Wanted to try std:: unordered_set, but at us support 11 standards is disconnected, and quickly I it cannot include - there the order of 800 errors connected with constexpr... PS. Tried to remove unnecessary particulars but if it is necessary - I can explain more in detail, as what for becomes. If very much is a part of implementation of algorithm of selection of areas on the binary image. We try to accelerate it, optimization of an identification of indexes already made (through disjoint set union, there the tree is used, amortized complexity O (a (n)) that is almost a constant). Actually it also is indexes.