[#bsl-basic_ostringstream-2constructor-0f] = xref:bsl.adoc[bsl]::xref:bsl/basic_ostringstream.adoc[basic_ostringstream]::basic_ostringstream :relfileprefix: ../../ :mrdocs: Constructors == Synopses Declared in `<bslstl_ostringstream.h>` Create a `basic_ostringstream` object having the same value as the specified `original` object by moving the contents of `original` to the newly‐created object. Optionally specify the `allocator` used to supply memory. `original` is left in a valid but unspecified state. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/basic_ostringstream/2constructor-00d.adoc[basic_ostringstream](xref:bsl/basic_ostringstream.adoc[basic_ostringstream]&& original); ---- [.small]#xref:bsl/basic_ostringstream/2constructor-00d.adoc[_» more..._]# Create a `basic_ostringstream` object. Use the specified `initialString` indicating the value that will be returned by a call to `str` prior to any streaming operations performed on this object. Optionally specify a `modeBitMask` indicating whether the underlying stream‐buffer may also be read from (`rdbuf` is created using `modeBitMask | ios_base::out`). If `modeBitMask` is not supplied, `rdbuf` will be created using `ios_base::out`. Optionally specify the `allocator` used to supply memory. If `allocator` is not supplied, the allocator in `initialString` is used. `initialString` is left in a valid but unspecified state. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit xref:bsl/basic_ostringstream/2constructor-0a.adoc[basic_ostringstream](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<StringType>] initialString); ---- [.small]#xref:bsl/basic_ostringstream/2constructor-0a.adoc[_» more..._]# Create a `basic_ostringstream` object. Optionally specify a `modeBitMask` indicating whether the underlying stream‐buffer may also be read from (`rdbuf` is created using `modeBitMask | ios_base::out`). If `modeBitMask` is not supplied, `rdbuf` will be created using `ios_base::out`. Optionally specify an `initialString` indicating the value that will be returned by a call to `str` prior to any streaming operations performed on this object. If `initialString` is not supplied, `str` will initially return an empty string. Optionally specify the `allocator` used to supply memory. If `allocator` is not supplied, a default‐constructed object of the (template parameter) `ALLOCATOR` type is used. If the `ALLOCATOR` argument is of type `bsl::allocator` (the default), then `allocator`, if supplied, shall be convertible to `bslma::Allocator *`. If the `ALLOCATOR` argument is of type `bsl::allocator` and `allocator` is not supplied, the currently installed default allocator will be used to supply memory. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit xref:bsl/basic_ostringstream/2constructor-0b.adoc[basic_ostringstream](xref:bsl/basic_ostringstream/allocator_type.adoc[allocator_type] const& allocator = allocator_type()); ---- [.small]#xref:bsl/basic_ostringstream/2constructor-0b.adoc[_» more..._]# Create a `basic_ostringstream` object. Use the specified `initialString` (of a type convertible to `basic_string_view<CHAR_TYPE, CHAR_TRAITS>` but not to `const CHAR_TYPE *`) indicating the initial sequence of characters that have been written to this stream. `rdbuf` is created using `ios_base::out`. Optionally specify the `allocator` used to supply memory. If `allocator` is not supplied, a default‐constructed object of the (template parameter) `ALLOCATOR` type is used. If the `ALLOCATOR` argument is of type `bsl::allocator` (the default), then `allocator`, if supplied, shall be convertible to `bslma::Allocator *`. If the `ALLOCATOR` argument is of type `bsl::allocator` and `allocator` is not supplied, the currently installed default allocator will be used to supply memory. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class STRING_VIEW_LIKE_TYPE> explicit xref:bsl/basic_ostringstream/2constructor-01.adoc[basic_ostringstream](STRING_VIEW_LIKE_TYPE const& initialString); ---- [.small]#xref:bsl/basic_ostringstream/2constructor-01.adoc[_» more..._]# Same as the constructor taking `const allocator_type&`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit xref:bsl/basic_ostringstream/2constructor-07.adoc[basic_ostringstream]( ios_base::openmode modeBitMask, xref:bsl/basic_ostringstream/allocator_type.adoc[allocator_type] const& allocator = allocator_type()); ---- [.small]#xref:bsl/basic_ostringstream/2constructor-07.adoc[_» more..._]# Same as the constructor taking `MovableRef<StringType>`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/basic_ostringstream/2constructor-08.adoc[basic_ostringstream]( xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<StringType>] initialString, ios_base::openmode modeBitMask); ---- [.small]#xref:bsl/basic_ostringstream/2constructor-08.adoc[_» more..._]# Same as the constructor taking `MovableRef<StringType>`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/basic_ostringstream/2constructor-06.adoc[basic_ostringstream]( xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<StringType>] initialString, xref:bsl/basic_ostringstream/allocator_type.adoc[allocator_type] const& allocator); ---- [.small]#xref:bsl/basic_ostringstream/2constructor-06.adoc[_» more..._]# Same as the constructor taking `const allocator_type&`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit xref:bsl/basic_ostringstream/2constructor-05.adoc[basic_ostringstream]( xref:bsl/basic_ostringstream.adoc[StringType] const& initialString, xref:bsl/basic_ostringstream/allocator_type.adoc[allocator_type] const& allocator = allocator_type()); ---- [.small]#xref:bsl/basic_ostringstream/2constructor-05.adoc[_» more..._]# Same as the move constructor taking `basic_ostringstream&&`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/basic_ostringstream/2constructor-0c2b.adoc[basic_ostringstream]( xref:bsl/basic_ostringstream.adoc[basic_ostringstream]&& original, xref:bsl/basic_ostringstream/allocator_type.adoc[allocator_type] const& allocator); ---- [.small]#xref:bsl/basic_ostringstream/2constructor-0c2b.adoc[_» more..._]# Create a `basic_ostringstream` object. Use the specified `initialString` (of a type convertible to `basic_string_view<CHAR_TYPE, CHAR_TRAITS>` but not to `const CHAR_TYPE *`) indicating the initial sequence of characters that have been written to this stream. Use the specified `modeBitMask` to indicate whether this buffer may be read from, written to, or both. `rdbuf` is created using `modeBitMask | ios_base::out`. Optionally specify the `allocator` used to supply memory. If `allocator` is not supplied, a default‐constructed object of the (template parameter) `ALLOCATOR` type is used. If the `ALLOCATOR` argument is of type `bsl::allocator` (the default), then `allocator`, if supplied, shall be convertible to `bslma::Allocator *`. If the `ALLOCATOR` argument is of type `bsl::allocator` and `allocator` is not supplied, the currently installed default allocator will be used to supply memory. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class STRING_VIEW_LIKE_TYPE> xref:bsl/basic_ostringstream/2constructor-0c25.adoc[basic_ostringstream]( STRING_VIEW_LIKE_TYPE const& initialString, ios_base::openmode modeBitMask); ---- [.small]#xref:bsl/basic_ostringstream/2constructor-0c25.adoc[_» more..._]# Create a `basic_ostringstream` object. Use the specified `initialString` as the value that will be returned by a call to `str` prior to any streaming operations performed on this object. `rdbuf` is created using `ios_base::out`. Optionally specify the `allocator` used to supply memory. If `allocator` is not supplied, a default‐constructed object of the (template parameter) `ALLOCATOR` type is used. If the `ALLOCATOR` argument is of type `bsl::allocator` (the default), then `allocator`, if supplied, shall be convertible to `bslma::Allocator *`. If the `ALLOCATOR` argument is of type `bsl::allocator` and `allocator` is not supplied, the currently installed default allocator will be used to supply memory. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class SALLOC> xref:bsl/basic_ostringstream/2constructor-0d.adoc[basic_ostringstream]( xref:bsl/basic_string-0faf.adoc[bsl::basic_string<CHAR_TYPE, CHAR_TRAITS, SALLOC>] const& initialString, xref:bsl/basic_ostringstream/allocator_type.adoc[allocator_type] const& allocator = allocator_type()) requires !bsl::is_same<ALLOCATOR, SALLOC>::value; ---- [.small]#xref:bsl/basic_ostringstream/2constructor-0d.adoc[_» more..._]# Same as the constructor taking `MovableRef<StringType>` and `ios_base::openmode`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/basic_ostringstream/2constructor-035.adoc[basic_ostringstream]( xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<StringType>] initialString, ios_base::openmode modeBitMask, xref:bsl/basic_ostringstream/allocator_type.adoc[allocator_type] const& allocator); ---- [.small]#xref:bsl/basic_ostringstream/2constructor-035.adoc[_» more..._]# Same as the constructor taking `const StringType&` and `const allocator_type&`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/basic_ostringstream/2constructor-03d.adoc[basic_ostringstream]( xref:bsl/basic_ostringstream.adoc[StringType] const& initialString, ios_base::openmode modeBitMask, xref:bsl/basic_ostringstream/allocator_type.adoc[allocator_type] const& allocator = allocator_type()); ---- [.small]#xref:bsl/basic_ostringstream/2constructor-03d.adoc[_» more..._]# Create a `basic_ostringstream` object. Use the specified `initialString` as the value that will be returned by a call to `str` prior to any streaming operations performed on this object. Use the specified `modeBitMask` to indicate whether the underlying stream‐buffer may also be read from (`rdbuf` is created using `modeBitMask | ios_base::out`). Optionally specify the `allocator` used to supply memory. If `allocator` is not supplied, a default‐constructed object of the (template parameter) `ALLOCATOR` type is used. If the `ALLOCATOR` argument is of type `bsl::allocator` (the default), then `allocator`, if supplied, shall be convertible to `bslma::Allocator *`. If the `ALLOCATOR` argument is of type `bsl::allocator` and `allocator` is not supplied, the currently installed default allocator will be used to supply memory. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class SALLOC> xref:bsl/basic_ostringstream/2constructor-004.adoc[basic_ostringstream]( xref:bsl/basic_string-0faf.adoc[bsl::basic_string<CHAR_TYPE, CHAR_TRAITS, SALLOC>] const& initialString, ios_base::openmode modeBitMask, xref:bsl/basic_ostringstream/allocator_type.adoc[allocator_type] const& allocator = allocator_type()) requires !bsl::is_same<ALLOCATOR, SALLOC>::value; ---- [.small]#xref:bsl/basic_ostringstream/2constructor-004.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#