aboutsummaryrefslogtreecommitdiff
path: root/absl/strings/internal/ostringstream.cc
diff options
context:
space:
mode:
authorAndy Getzendanner <durandal@google.com>2022-09-14 09:23:31 -0700
committerCopybara-Service <copybara-worker@google.com>2022-09-14 09:24:31 -0700
commitd423ac0ef052bd7b6fc53fd1a026a44e1713d993 (patch)
tree8169581dc63f2d180cf4c57be960de0178a0d171 /absl/strings/internal/ostringstream.cc
parent4832049e5c050cd4b50182d0fc061b99bf64b4b6 (diff)
downloadabseil-d423ac0ef052bd7b6fc53fd1a026a44e1713d993.tar.gz
abseil-d423ac0ef052bd7b6fc53fd1a026a44e1713d993.tar.bz2
abseil-d423ac0ef052bd7b6fc53fd1a026a44e1713d993.zip
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
Diffstat (limited to 'absl/strings/internal/ostringstream.cc')
-rw-r--r--absl/strings/internal/ostringstream.cc21
1 files changed, 14 insertions, 7 deletions
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 <cassert>
+#include <cstddef>
+#include <ios>
+#include <streambuf>
+
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<char>(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<char>(c));
return 1;
}
-std::streamsize OStringStream::xsputn(const char* s, std::streamsize n) {
- assert(s_);
- s_->append(s, static_cast<size_t>(n));
+std::streamsize OStringStream::Streambuf::xsputn(const char* s,
+ std::streamsize n) {
+ assert(str_);
+ str_->append(s, static_cast<size_t>(n));
return n;
}