From d423ac0ef052bd7b6fc53fd1a026a44e1713d993 Mon Sep 17 00:00:00 2001 From: Andy Getzendanner Date: Wed, 14 Sep 2022 09:23:31 -0700 Subject: Implement correct move constructor and assignment for absl::strings_internal::OStringStream, and mark that class final. This should be explicit per https://google.github.io/styleguide/cppguide.html#Copyable_Movable_Types, and is currently hard to infer due to multiple inheritance. PiperOrigin-RevId: 474311032 Change-Id: I72d7adcb9f7a991c19c26bc7083a4df31de5da49 --- absl/strings/internal/ostringstream.cc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'absl/strings/internal/ostringstream.cc') diff --git a/absl/strings/internal/ostringstream.cc b/absl/strings/internal/ostringstream.cc index dc6cfe16..a0e5ec08 100644 --- a/absl/strings/internal/ostringstream.cc +++ b/absl/strings/internal/ostringstream.cc @@ -14,20 +14,27 @@ #include "absl/strings/internal/ostringstream.h" +#include +#include +#include +#include + namespace absl { ABSL_NAMESPACE_BEGIN namespace strings_internal { -OStringStream::Buf::int_type OStringStream::overflow(int c) { - assert(s_); - if (!Buf::traits_type::eq_int_type(c, Buf::traits_type::eof())) - s_->push_back(static_cast(c)); +OStringStream::Streambuf::int_type OStringStream::Streambuf::overflow(int c) { + assert(str_); + if (!std::streambuf::traits_type::eq_int_type( + c, std::streambuf::traits_type::eof())) + str_->push_back(static_cast(c)); return 1; } -std::streamsize OStringStream::xsputn(const char* s, std::streamsize n) { - assert(s_); - s_->append(s, static_cast(n)); +std::streamsize OStringStream::Streambuf::xsputn(const char* s, + std::streamsize n) { + assert(str_); + str_->append(s, static_cast(n)); return n; } -- cgit v1.2.3