[libcxx-commits] [PATCH] D120996: [libc++] Remove extension to support allocator<const T>
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Mar 4 08:13:15 PST 2022
Quuxplusone added inline comments.
================
Comment at: libcxx/docs/ReleaseNotes.rst:68-71
+- The extension for ``std::allocator`` to support ``const`` types has been removed.
+ In particular, this means that instantiating most container types with const-qualified
+ types will not work anymore (for example ``std::vector<const int>`` won't work anymore).
+ If you were using that pattern, please use a non const-qualified type instead.
----------------
I think this buries the lede a little bit. I'd say more like
```
- libc++ no longer supports containers of ``const``-qualified element type,
such as ``vector<const T>`` and ``list<const T>``. This used to be supported
as an extension. Likewise, ``std::allocator<const T>`` is no longer supported.
If you were using ``vector<const T>``, replace it with ``vector<T>`` instead.
```
I actually wonder whether this change matters to `list<const T>`, since it's a node-based container. Should you add `libcxx/test/libcxx/.../const_element_type.verify.cpp` tests that check what happens with const-qualified element types? If `list<const T>` and `set<const T>` still work in practice, should we continue kinda-sorta-supporting them, and document here that `vector` and `deque` are the only two containers that have been de-supported?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120996/new/
https://reviews.llvm.org/D120996
More information about the libcxx-commits
mailing list