[#bsl-StringBufContainer] = xref:bsl.adoc[bsl]::StringBufContainer :relfileprefix: ../ :mrdocs: This class enables the implementation of string‐stream types by providing a trivial type containing a `basic_stringbuf` that is suitable as a (`private`) base class for a string‐stream. Inheriting from `StringBufContainer` allows the string‐stream to ensure that the contained `basic_stringbuf` is initialized before initializing other base classes or data members without potentially overriding `virtual` methods in the `basic_stringbuf` type. Note that implementations of string‐stream types must pass the address of a string‐buffer to their `public` base class (e.g., `basic_stream`), so the string‐stream must ensure (using `private` inheritance) that the string‐buffer is initialized before constructing the `public` base class. If a string‐stream implementation were to directly inherit from `basic_streambuf`, then `virtual` methods defined in that string‐stream (e.g., `underflow`) might incorrectly override those in the `basic_stringbuf` implementation. == Synopsis Declared in `<bslstl_stringbuf.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class CHAR_TYPE, class CHAR_TRAITS, class ALLOCATOR> class StringBufContainer; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/StringBufContainer/2constructor-0f.adoc[`StringBufContainer`] [.small]#[constructor]# | Constructors | xref:bsl/StringBufContainer/operator_assign.adoc[`operator=`] | Assign to this object the value of the specified `rhs`, and return a reference providing modifiable access to this object. The contents of `rhs` are move‐assigned to this object. `rhs` is left in a valid but unspecified state. | xref:bsl/StringBufContainer/rdbuf.adoc[`rdbuf`] | Return an address providing modifiable access to the contained `basic_stringbuf` object. | xref:bsl/StringBufContainer/swap.adoc[`swap`] | Efficiently exchange the value of this object with the value of the specified `other` object. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#