[libcxx-commits] [libcxx] Add `_LIBCPP_PLACEMENT_NEW_DEFINED` macro to allow for user defined placement new operators (PR #70538)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Oct 30 20:54:05 PDT 2023
ldionne wrote:
> #### Just include `<new>` and stop working around the `std`
> Include times. `<new>` is expensive to include on a variety of `std` implementations.
I just looked and our `<new>` header should be really cheap to include. Other stdlibs should also make that cheap, otherwise it's arguably a QOI defect against them. Another option is to use `#include <version>` and then check for `#ifdef _LIBCPP_VERSION` to check whether libc++ is in use or not -- then you can include `<new>` only if libc++ is in use cause it's cheap to do so. On other implementations that are more expensive you can use another workaround such as `__PLACEMENT_NEW_INLINE`.
I am quite reluctant to add any kind of complexity to the library to work around something like this -- I don't think that's the right tradeoff here.
https://github.com/llvm/llvm-project/pull/70538
More information about the libcxx-commits
mailing list