[ostringstream.cons] (original) (raw)

31 Input/output library [input.output]

31.8 String-based streams [string.streams]

31.8.4 Class template basic_ostringstream [ostringstream]

31.8.4.2 Constructors [ostringstream.cons]

explicit basic_ostringstream(ios_base::openmode which);

Effects: Initializes the base class withbasic_ostream<charT, traits>(addressof(sb)) ([ostream]) and sb withbasic_stringbuf<charT, traits, Allocator>(which | ios_base​::​out) ([stringbuf.cons]).

explicit basic_ostringstream( const basic_string<charT, traits, Allocator>& s, ios_base::openmode which = ios_base::out);

Effects: Initializes the base class withbasic_ostream<charT, traits>(addressof(sb)) ([ostream]) and sb withbasic_stringbuf<charT, traits, Allocator>(s, which | ios_base​::​out)
([stringbuf.cons]).

basic_ostringstream(ios_base::openmode which, const Allocator& a);

Effects: Initializes the base class withbasic_ostream<charT, traits>(addressof(sb)) ([ostream]) and sb withbasic_stringbuf<charT, traits, Allocator>(which | ios_base​::​out, a)
([stringbuf.cons]).

explicit basic_ostringstream( basic_string<charT, traits, Allocator>&& s, ios_base::openmode which = ios_base::out);

Effects: Initializes the base class withbasic_ostream<charT, traits>(addressof(sb)) ([ostream]) and sb withbasic_stringbuf<charT, traits, Allocator>(std​::​move(s), which | ios_base​::​​out) ([stringbuf.cons]).

template<class SAlloc> basic_ostringstream( const basic_string<charT, traits, SAlloc>& s, ios_base::openmode which, const Allocator& a);

Effects: Initializes the base class withbasic_ostream<charT, traits>(addressof(sb)) ([ostream]) and sb withbasic_stringbuf<charT, traits, Allocator>(s, which | ios_base​::​out, a)
([stringbuf.cons]).

template<class SAlloc> explicit basic_ostringstream( const basic_string<charT, traits, SAlloc>& s, ios_base::openmode which = ios_base::out);

Constraints: is_same_v<SAlloc,Allocator> is false.

Effects: Initializes the base class withbasic_ostream<charT, traits>(addressof(sb)) ([ostream]) and sb withbasic_stringbuf<charT, traits, Allocator>(s, which | ios_base​::​out)
([stringbuf.cons]).

template<class T> explicit basic_ostringstream(const T& t, ios_base::openmode which = ios_base::out);template<class T> basic_ostringstream(const T& t, const Allocator& a);template<class T> basic_ostringstream(const T& t, ios_base::openmode which, const Allocator& a);

Let which be ios_base​::​outfor the overload with no parameter which, anda be Allocator() for the overload with no parameter a.

Constraints: is_convertible_v<const T&, basic_string_view<charT, traits>>is true.

Effects: Initializes the base class with addressof(sb), and direct-non-list-initializes sb with t, which | ios_base​::​out, a.

basic_ostringstream(basic_ostringstream&& rhs);

Effects: Move constructs from the rvalue rhs.

This is accomplished by move constructing the base class, and the containedbasic_stringbuf.

Then calls basic_ostream<charT, traits>​::​set_rdbuf(addressof(sb))to install the contained basic_stringbuf.