[libcxx-commits] [PATCH] D110994: [libc++] Make test_allocator constexpr-friendly for constexpr string/vector
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Oct 19 15:40:36 PDT 2021
philnik added inline comments.
================
Comment at: libcxx/test/support/test_allocator.h:256-263
#if TEST_STD_VER < 11
- void construct(pointer p, const T& val)
- {::new(static_cast<void*>(p)) T(val);}
+ void construct(pointer p, const T& val) { ::new (static_cast<void*>(p)) T(val); }
#else
- template <class U> void construct(pointer p, U&& val)
- {::new(static_cast<void*>(p)) T(std::forward<U>(val));}
+ template <class U>
+ void construct(pointer p, U&& val) {
+ ::new (static_cast<void*>(p)) T(std::forward<U>(val));
+ }
----------------
ldionne wrote:
> Based on what I did in D68365, I think the correct definition of this would be:
>
> ```
> #if TEST_STD_VER < 11
> void construct(pointer p, const T& val) {
> ::new(static_cast<void*>(p)) T(val);
> }
> #elif TEST_STD_VER < 20
> template <class U>
> void construct(pointer p, U&& val) {
> ::new(static_cast<void*>(p)) T(std::forward<U>(val));
> }
> #else
> template <class U>
> constexpr void construct(pointer p, U&& val) {
> std::construct_at(p, std::forward<U>(val));
> }
> #endif
> ```
>
I think it can just be removed, since it doesn't ever get used anyways and is removed in C++20 from ##std::allocator##.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110994/new/
https://reviews.llvm.org/D110994
More information about the libcxx-commits
mailing list