[libcxx-commits] [PATCH] D116815: [libc++] basic_string::resize_and_overwrite: Adopt LWG3645 (Not voted in yet)
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jan 7 08:40:19 PST 2022
philnik created this revision.
philnik added reviewers: Quuxplusone, Mordante, ldionne.
philnik requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Adopt LWG3645, which fixes the value categories of basic_string::resize_and_overwrite
https://timsong-cpp.github.io/lwg-issues/3645
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116815
Files:
libcxx/include/string
libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp
Index: libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp
===================================================================
--- libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp
+++ libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp
@@ -75,7 +75,8 @@
void test_value_categories() {
std::string s;
- s.resize_and_overwrite(10, [](char*&, size_t&) { return 0; });
+ s.resize_and_overwrite(10, [](char*&&, size_t&&) { return 0; });
+ s.resize_and_overwrite(10, [](char* const&, const size_t&) { return 0; });
struct RefQualified {
int operator()(char*, size_t) && { return 0; }
};
Index: libcxx/include/string
===================================================================
--- libcxx/include/string
+++ libcxx/include/string
@@ -982,8 +982,7 @@
_LIBCPP_HIDE_FROM_ABI constexpr
void resize_and_overwrite(size_type __n, _Op __op) {
__resize_default_init(__n);
- pointer __data = data();
- __erase_to_end(_VSTD::move(__op)(__data, __n));
+ __erase_to_end(_VSTD::move(__op)(data(), +__n));
}
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116815.398163.patch
Type: text/x-patch
Size: 1156 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220107/34ca14e0/attachment.bin>
More information about the libcxx-commits
mailing list