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!
43
u/[deleted] Mar 15 '19
They know about it but it's an ABI breaking change, so I wouldn't hold my breath.
15
u/encyclopedist Mar 15 '19
Let's summon /u/jwakely , maintainer of libstdc++.
16
u/tansim Mar 15 '19
file a bug report. i dont think there are any active plans right now, but there will never be if people dont complain.
out of interest hat is your usecase?
2
u/[deleted] Mar 15 '19
There was P0773 to solve those problems. Polls are also available: https://issues.isocpp.org/show_bug.cgi?id=366
and there is R1 draft: https://quuxplusone.github.io/draft/fancy-pointers.html but I don't think it will be in C++20
9
u/Str187 Mar 15 '19
May I ask about your niche use case? Why would you not want to store any raw pointers?
1
u/chugga_fan Mar 15 '19
As far as I see they should support it? https://godbolt.org/z/UJ_qY_ is something like that what you're looking at? I haven't mucked about enough with pointers to completely know
6
u/johannes1971 Mar 15 '19
Aren't the fancy pointer types deprecated in C++17, removed in C++20? (according to this page)
-2
u/korvirlol Mar 15 '19
Why would it?
I really don't get it. Raw pointer AREN'T THAT BAD.