[libcxx-commits] [libcxx] [libc++] Avoid including vector in <functional> (PR #144310)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Jun 21 00:19:25 PDT 2025
philnik777 wrote:
> > I don't think that's a viable path forward. You're basically asking to double the include time of `<functional>` to make things work with our current tests to avoid removing includes. IMO that's not something we should ever do.
>
> I'm not asking to double the include time of `<functional>` -- it including `<vector>` is the status quo. I am saying that we should not be making changes like this one that we know for a fact will break many users (in a trivial way, sure) when we have an easy way not to. Instead, we should be intentional about these breaks.
I'm not sure if we're just talking past each other here. The status quo is that `<__vector/vector.h>` is included. Do you mean that? If you actually mean `<vector>`, that is not the status quo. `#include <functional> #include <vector>` takes almost twice as long as `#include <functional>` in C++23 in trunk.
> For example: we want to drop all of the transitive includes every other release? Sure, that's something we can try out. Or just once in the next release? Also something we can try out. But we should have proper communication and we should do it intentionally. Otherwise, we are just creating constant churn for users who are trying to update (or have to update), and the benefit is something that many of them just don't care about.
>
> I don't want to make it more difficult for the library to move forward and make these kinds of improvements. But I want to have a principled way of moving forward with changes that we know for a fact will break people.
I absolutely agree that we should be intentional. My concern is that we currently have no tool to ensure we're not accidentally removing features from C++23. Previous modes are much better off because they weren't granular from the start, making the current "don't drop top-level headers" pretty good. That's not a viable approach anymore as this and other patches show.
https://github.com/llvm/llvm-project/pull/144310
More information about the libcxx-commits
mailing list