[libcxx-commits] [PATCH] D157776: [libc++] Eliminate extra allocations from `std::move(oss).str()`

Amirreza Ashouri via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 12 05:02:00 PDT 2023


AMP999 created this revision.
AMP999 added projects: libc++, LLVM.
Herald added a project: All.
AMP999 requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

As an extension, support `string(std::move(s), pos, n)` in C++20
as well as C++23. Otherwise ,it's difficult to implement the 
behavior for `std::move(oss).str()` in C++

Add test coverage for the new behaviors, especially to verify 
the returned string uses the correct allocator.

Fixes the issue https://github.com/llvm/llvm-project/issues/64644


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157776

Files:
  libcxx/include/sstream
  libcxx/include/string
  libcxx/test/std/input.output/string.streams/istringstream/istringstream.members/str.allocator_propagation.pass.cpp
  libcxx/test/std/input.output/string.streams/istringstream/istringstream.members/str.move.pass.cpp
  libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.members/str.allocator_propagation.pass.cpp
  libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.members/str.move.pass.cpp
  libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.move.pass.cpp
  libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.pass.cpp
  libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.members/view.pass.cpp
  libcxx/test/std/input.output/string.streams/stringstream/stringstream.members/str.allocator_propagation.pass.cpp
  libcxx/test/std/input.output/string.streams/stringstream/stringstream.members/str.move.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157776.549596.patch
Type: text/x-patch
Size: 27100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230812/4e912706/attachment-0001.bin>


More information about the libcxx-commits mailing list