[libcxx-commits] [PATCH] D153709: [libc++] Implement stringbuf members of P0408R7 (Efficient Access to basic_stringbuf's Buffer)

Piotr Fusik via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 26 10:46:48 PDT 2023


pfusik added inline comments.


================
Comment at: libcxx/include/sstream:422
     __hm_ = __hm == -1 ? nullptr : __p + __hm;
     __p = const_cast<char_type*>(__rhs.__str_.data());
     __rhs.setg(__p, __p, __p);
----------------
Mordante wrote:
> We still need to look at this issue.
I think it is okay to use `nullptr` instead of `__p` obtained from the moved string.
But since it is an unrelated fix, I'd prefer to do this in a separate change.


================
Comment at: libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string-alloc.mode.pass.cpp:34
+  const std::basic_stringbuf<CharT> buf(s, std::ios_base::in);
+  assert(buf.view() == SV("testing"));
+}
----------------
Mordante wrote:
> How about testing the allocator of `buf.str()`?
> Maybe we should do even more testing the expected allocator is used. The `test_allocator` has ways to log that information.
How?
`stringbuf` fixes its allocator at construction time. Here we are testing a constructor overload that doesn't accept an allocator.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153709



More information about the libcxx-commits mailing list