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

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 20 10:43:46 PDT 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/test/libcxx/strings/basic.string/string.capacity/resize.exact.cpp:28
+  const size_t kSsoSize = S().capacity();
+  const size_t kAlign = 16;
+  for (int i = kSsoSize + 1; i < 1 << 10; ++i) {
----------------
Quuxplusone wrote:
> Should this be `alignof(std::max_align_t)`? Or what's the significance of `16` — how was it computed?
> Regarding `kAlign`, this is [`basic_string::__alignment`, which is private.](https://github.com/llvm/llvm-project/blob/2d0f1fa/libcxx/include/string#L1577) Do you think it's okay to include this implementation detail here?

Well, //I// have no better suggestion; defer to @ldionne here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102727



More information about the libcxx-commits mailing list