[libcxx-commits] [libcxx] [libc++] Avoid including vector in <functional> (PR #144310)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 20 09:11:44 PDT 2025


ldionne wrote:

> > In that case, I do have an issue with this patch as-is. It would be trivial for us to keep including `<vector>` from `<functional>` in C++23 (which is a stable standard mode) to avoid breaking people.
> 
> What do you mean by "stable standard mode"?

I mean that C++23 has been released by ISO and we consider it a standard mode that people can write production code with. That is unlike e.g. C++26 where things could still technically change since it hasn't been ratified yet.

> 
> 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.

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.

https://github.com/llvm/llvm-project/pull/144310


More information about the libcxx-commits mailing list