implement
- make_unique_for_overwrite
- make_shared_for_overwrite
- allocate_shared_for_overwrite
These functions are almost the same as make_unique, make_shared, allocate_shared with no arguments except that they don't value initialise the objects
Paths
| Differential D140913
[libc++] implement P1020R1 P1973R1 make_unique[shared]_for_overwrite ClosedPublic Authored by huixie90 on Jan 3 2023, 10:52 AM.
Details
Summary implement
These functions are almost the same as make_unique, make_shared, allocate_shared with no arguments except that they don't value initialise the objects
Diff Detail
Event TimelineComment Actions I only skimmed over the patch, can you update the description what it exactly does. FYI when you create a patch with arc you can use --draft to mark it as draft, then it will be tested by the CI but not show in the review queue.
ldionne added inline comments.
This revision now requires changes to proceed.Jan 12 2023, 10:24 AM huixie90 retitled this revision from [In Progress] [libc++] make_unique[shared]_for_overwrite to [libc++] implement P1020R1 P1973R1 make_unique[shared]_for_overwrite.Jan 15 2023, 9:35 AM ldionne added inline comments. This revision is now accepted and ready to land.Jan 20 2023, 8:52 AM This revision was landed with ongoing or failed builds.Jan 23 2023, 1:08 PM Closed by commit rG9af9d39a47dc: [libc++] implement P1020R1 P1973R1 make_unique[shared]_for_overwrite (authored by Hui). · Explain Why This revision was automatically updated to reflect the committed changes. Comment Actions Per https://lists.isocpp.org/lib/2018/11/9316.php allocate_shared_for_overwrite should not call allocator_traits::destroy, which I think this implementation does? Comment Actions
Ugh, it shouldn't be destroyed at all? I hadn't read it that way. Comment Actions
It should call the destructor directly, not go through the allocator (since the objects aren't constructed using the allocator). I need to file an issue to fix the standard. Comment Actions
Ah, yes, I just re-read the e-mail you linked and I get it. I think we already implement LWG 3008 in its current form, but we wouldn't after your fix. Thanks for the heads up, I'll fix this and backport to LLVM 16.
Revision Contents
Diff 491488 libcxx/docs/ReleaseNotes.rst
libcxx/docs/Status/Cxx20Papers.csv
libcxx/docs/Status/Cxx2b.rst
libcxx/docs/Status/Cxx2bPapers.csv
libcxx/include/__memory/shared_ptr.h
libcxx/include/__memory/unique_ptr.h
libcxx/include/memory
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_for_overwrite.pass.cpp
libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared_for_overwrite.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique_for_overwrite.default_init.pass.cpp
libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique_for_overwrite.pass.cpp
|
This doesn't need to be guarded since it's not public API.