[libcxx-commits] [libcxx] [libc++] Remove allocator support from std::function (PR #140395)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 10 06:01:11 PDT 2025
================
@@ -17,13 +17,7 @@
#include <__functional/binary_function.h>
#include <__functional/invoke.h>
#include <__functional/unary_function.h>
-#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
-#include <__memory/allocator.h>
-#include <__memory/allocator_destructor.h>
-#include <__memory/allocator_traits.h>
-#include <__memory/compressed_pair.h>
-#include <__memory/unique_ptr.h>
#include <__type_traits/aligned_storage.h>
----------------
ldionne wrote:
The point I was trying to make is that ignoring the allocator argument in this additional constructor could potentially lead to new breakages (at runtime, not at compile-time).
I don't think this is problematic anymore given that it only impacts C++11 and C++14. Let's still have a release note like this:
> ``std::function`` used to have allocator support, which was removed from the Standard as a defect report by http://wg21.link/p0302r1 due to issues with its design and inconsistent support from implementations. Previously, libc++ would provide the allocator-aware APIs in ``std::function`` in C++11 and C++14 mode, but would ignore that allocator argument in all but one place. Starting in this release, the allocator argument is always ignored, and a future release will remove the allocator-aware APIs altogether.
Something like this. But we should validate that it was a DR and confirm that we'll want to / be able to remove these APIs in the future (otherwise we should understand why we can't).
Edit: 6ecac730193dd55ab76b2ea1b42471749e942d0d provides some background, in particular the original paper http://wg21.link/p0302r1 is interesting to read.
https://github.com/llvm/llvm-project/pull/140395
More information about the libcxx-commits
mailing list