TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 229 subscribers
Post #24286 17
STL reimagined: What would you change, add or remove in a new STL implementation if API and ABI were not a concern?

Hello everyone,

I was just curious as to what would make a better STL if it was written today.

Things that come to mind immediately for me:

- Associative containers should not have const keys.
- Probably only emplace back, no push back.
- iterators escape and are unsafe.
- probably only a range abstraction that uses indexes like in Flux?
- allocators, according to Sean Parent, violate the whole/part principle, maybe memory allocationshould go out of containers?
- allocators should not be part of the type at all?
- only allocators for bytes?
- unordered containers should use linear probing.
- There should be some higher-level type-erased non-inteusive interfaces for containers?
- algorithms should admit only ranges.
-how about having Python-style container slicing in vector?
- library would not contain UB interfaces and fewer escape hatches and more difficult to misuse.


What do you think you would add/remove/modify?

https://redd.it/1p120w9
@r_cpp
Reddit From the cpp community on Reddit Explore this post and more from the cpp community
More from @r_cpp
  1. Oct 12, 2026ACCU Overload Journal 195 - October 2026 https://accu.org/journals/overload/overload195 ht…
  2. Oct 12, 2026C++ Contracts C++ contracts are a good thing, why are people saying it's a bad thing? Anyb…
  3. Oct 11, 2026wxWidgets 3.2.12 and 3.3.4 Released https://wxwidgets.org/news/2026/10/wxwidgets-3.2.12-an…
  4. Oct 11, 2026VKRT NES Remaster — an open-source C++20 NES emulator with an observation-driven remasteri…
  5. Oct 11, 2026Right way to test async code https://redd.it/1x2wqgz @r_cpp
  6. Oct 10, 2026Yantra: an LALR(1) parser generator for C++23 Yantra: an LALR(1) parser generator for C++2…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →