[libcxx-commits] [libcxx] [libc++] Implement p0753r2 Manipulators for C++ Synchronized Buffered Ostream (PR #97955)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 12 09:05:13 PDT 2024


================
@@ -361,7 +364,6 @@ private:
   // the now deprecated get_temporary_buffer
 
   basic_string<_CharT, _Traits, _Allocator> __str_;
-  bool __emit_on_sync_{false};
 
   _LIBCPP_HIDE_FROM_ABI bool emit(bool __flush) {
----------------
ldionne wrote:

We could make this `virtual __emit(bool) override final`, and define `virtual __emit(bool) = 0` in the base class. Then we get rid of the confusion due to overloading the `emit` name for private and public things, and we also gain the functionality we need from the base class.

>From the base class, we can now call `__buf->__emit(false /* we just flushed above */);`

Also, since we're marking it as `final` here, the other calls to `__emit` in this class should be statically dispatched, so we don't leave any perf on the table (not that it would matter for this class).

https://github.com/llvm/llvm-project/pull/97955


More information about the libcxx-commits mailing list