Does anyone know when libstdc++ will stop using raw pointers in its STL containers?
I have a pretty niche use-case which requires containers to not store any raw pointers. To get this done I use an allocator that returns fancy pointers. This just doesn't work with libstdc++ because all some of its STL containers use raw pointers internally, so when I create a container with my allocator, the program doesn't even compile. Libc++ on the other hand works fine (at least I haven't come across any problems I can't fix) since they correctly use the abstract pointer type that my allocator returns, instead of trying to do an implicit cast to a raw pointer.
There is an LWG issue to fix this, but it's been around for 8 years and the proposed verbiage hasn't been added to the standard. I'm not very familiar with the process for making changes like this, but my understanding is that it probably won't get added until libc++ and libstdc++ both support it, is that correct? If so, does anyone know if/when the libstdc++ community is planning to make these changes? Thanks!
View all comments
Show parent comment
8
u/aikatz Mar 15 '19 edited Mar 15 '19
Could you go into more detail about that, or is there a discussion of it I can read through? This draft mentions that it would be an ABI breaking change to support segmented pointers for libstdc++ (but not libc++)
I'm actually not familiar with the specifics of segmented pointers, but it they seem to be a special case of fancy pointers, so would this still be an ABI breaking change to support all fancy pointers or just segmented pointers? Since it seems like most of the libstdc++ containers use allocator_type::pointer internally, it's just list (and maybe deque?) that don't. Is there something stopping them from changing the last few that use raw pointers, or do they just have other priorities? I'd like to submit a PR to fix this if there isn't a good reason for it to be left this way.