safe unordered local iterators

François Dumont francois.cppdevs@free.fr
Sun Jul 3 20:19:00 GMT 2011


Hi

     This is a proposition of patch to correctly handle the unordered 
containers local iterators. This patch adds tracking of the local 
iterator instances and detection of invalid usage like for the other 
kind of iterators. I have added a small test case to show what kind of 
invalid usage libstdc++ will be able to detect with this patch. For a 
number of questions I haven't found the answer in the standard draft, 
maybe I haven't looked for it enough, I hope you will be able to help:

- In safe mode I consider as invalid comparison of local iterators from 
different buckets, is it ok ?
- When the unordered container is rehashed I invalidate all local 
iterators except local end iterators, whatever bucket they come from. 
This is so because local end iterators are container independant, they 
simply point to a null node. They are kept valid even if after the 
rehashed operation the bucket origin is greater than the new bucket 
count. Do you think it is ok ?
- Regarding exports, I have exported only what will normally be used 
from user code and not all methods implemented in src/debug.cc file. I 
wonder if, thanks to some inlinement at link time, other symbols 
shouldn't be exported too. Should I export all symbols implemented in 
src/debug.cc ?

Thanks for your help.

Regards

François



-------------- next part --------------
A non-text attachment was scrubbed...
Name: safe_unordered.patch
Type: text/x-patch
Size: 90267 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20110703/2905570d/attachment.bin>


More information about the Libstdc++ mailing list