[libcxx-commits] [PATCH] D102727: Use precise growth rather than amortized growth in std::string::resize/__resize_default_init.

Evan Brown via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 19 15:05:01 PDT 2021


ezbr updated this revision to Diff 359932.
ezbr edited the summary of this revision.
ezbr added a comment.

Guard changes behind new _LIBCPP_ABI_EXACT_STRING_RESIZE config flag and add a test.

We enable the new config flag in unstable ABI/ABI version 2.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102727/new/

https://reviews.llvm.org/D102727

Files:
  libcxx/test/libcxx/strings/basic.string/string.capacity/resize.exact.cpp


Index: libcxx/test/libcxx/strings/basic.string/string.capacity/resize.exact.cpp
===================================================================
--- libcxx/test/libcxx/strings/basic.string/string.capacity/resize.exact.cpp
+++ libcxx/test/libcxx/strings/basic.string/string.capacity/resize.exact.cpp
@@ -22,8 +22,7 @@
 bool is_between(size_t c, size_t low, size_t hi) { return c >= low && c <= hi; }
 
 template <class S>
-void test()
-{
+void test() {
   // Tests that resize() uses exact growth rather than exponential growth.
   const size_t kSsoSize = S().capacity();
   const size_t kAlign = 16;
@@ -45,8 +44,7 @@
   }
 }
 
-int main(int, char**)
-{
+int main(int, char**) {
   {
     typedef std::string S;
     test<S>();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102727.359932.patch
Type: text/x-patch
Size: 731 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210719/e9bc1928/attachment-0001.bin>


More information about the libcxx-commits mailing list