On 22/05/16 17:16 +0200, François Dumont wrote:
Hi

To fix 71181 problem I propose to change how we deal with reserve called with pivot values that is to say prime numbers. Now _M_next_bkt always return a value higher than the input value. This way when reverse(97) is called we end up with 199 buckets and so enough space to store 97 values without rehashing.

I have integrated in this patch several other enhancements on the same subject. Improvement of _M_next_resize management when reaching highest bucket number. Remove sentinel value in __prime_list, just need to limit range when calling lower_bound.

I don't think the change to __prime_list is safe. If you compile some
code with GCC 5 and then used a libstdc++.so with this change the old
code would still be looking for the sentinel in the array, and would
not find it.

I think it would be safe to leave the old __prime_list unchanged (and
then not need to change anything in tr1/hashtable_policy.h?) and add a
new array with a different name. Existing code compiled with older
versions of GCC would still find __prime_list, but the new code would
use a different array.

Reply via email to