They are not needed in <new> -- in fact they are only needed in .cpp files.
Getting those out of the way makes the headers smaller and also makes it
easier to use the library on platforms where aligned allocation is not
available.
Details
- Reviewers
ldionne - Group Reviewers
Restricted Project Restricted Project - Commits
- rG36080434a885: [libc++] Move the definition of aligned allocation helpers outside of <new>
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Rebase and address some comments
libcxx/include/__memory/aligned_alloc.h | ||
---|---|---|
11 | Like we do for many other implementation-detail headers, we don't include them in the main public header unless they provide something that is part of the public. We actually have the opposite policy (to include everything, as you mention), but we do it very inconsistently, sometimes because it's literally impossible to do otherwise. Hence, I think we should shift the policy towards including only the things that are necessary for the public API. |
libcxx/include/__memory/aligned_alloc.h | ||
---|---|---|
11 | I think it would be good to document our policy. I sometimes get the impression different developers have different ideas what the policies are. |
Why is the header not included by __memory? When intended it would be good to document why it's the case.
Then the guarded include in the .cpp files can be removed too.