143 lines
5.4 KiB
Markdown
143 lines
5.4 KiB
Markdown
[stringstream.cons]
|
||
|
||
# 31 Input/output library [[input.output]](./#input.output)
|
||
|
||
## 31.8 String-based streams [[string.streams]](string.streams#stringstream.cons)
|
||
|
||
### 31.8.5 Class template basic_stringstream [[stringstream]](stringstream#cons)
|
||
|
||
#### 31.8.5.2 Constructors [stringstream.cons]
|
||
|
||
[ð](#lib:basic_stringstream,constructor)
|
||
|
||
`explicit basic_stringstream(ios_base::openmode which);
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L9720)
|
||
|
||
*Effects*: Initializes the base class withbasic_iostream<charT, traits>(addressof(*sb*)) ([[iostream.cons]](iostream.cons "31.7.5.7.2 Constructors"))
|
||
and*sb* withbasic_stringbuf<charT, traits, Allocator>(which)[.](#1.sentence-1)
|
||
|
||
[ð](#lib:basic_stringstream,constructor_)
|
||
|
||
`explicit basic_stringstream(
|
||
const basic_string<charT, traits, Allocator>& s,
|
||
ios_base::openmode which = ios_base::out | ios_base::in);
|
||
`
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L9738)
|
||
|
||
*Effects*: Initializes the base class withbasic_iostream<charT, traits>(addressof(*sb*)) ([[iostream.cons]](iostream.cons "31.7.5.7.2 Constructors"))
|
||
and*sb* withbasic_stringbuf<charT, traits, Allocator>(s, which)[.](#2.sentence-1)
|
||
|
||
[ð](#lib:basic_stringstream,constructor__)
|
||
|
||
`basic_stringstream(ios_base::openmode which, const Allocator& a);
|
||
`
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L9754)
|
||
|
||
*Effects*: Initializes the base class withbasic_iostream<charT, traits>(addressof(*sb*)) ([[iostream.cons]](iostream.cons "31.7.5.7.2 Constructors"))
|
||
and *sb* withbasic_stringbuf<charT, traits, Allocator>(which, a) ([[stringbuf.cons]](stringbuf.cons "31.8.2.2 Constructors"))[.](#3.sentence-1)
|
||
|
||
[ð](#lib:basic_stringstream,constructor___)
|
||
|
||
`explicit basic_stringstream(
|
||
basic_string<charT, traits, Allocator>&& s,
|
||
ios_base::openmode which = ios_base::out | ios_base::in);
|
||
`
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L9770)
|
||
|
||
*Effects*: Initializes the base class withbasic_iostream<charT, traits>(addressof(*sb*)) ([[iostream.cons]](iostream.cons "31.7.5.7.2 Constructors"))
|
||
and *sb* withbasic_stringbuf<charT, traits, Allocator>(std::move(s), which) ([[stringbuf.cons]](stringbuf.cons "31.8.2.2 Constructors"))[.](#4.sentence-1)
|
||
|
||
[ð](#lib:basic_stringstream,constructor____)
|
||
|
||
`template<class SAlloc>
|
||
basic_stringstream(
|
||
const basic_string<charT, traits, SAlloc>& s,
|
||
ios_base::openmode which, const Allocator& a);
|
||
`
|
||
|
||
[5](#5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L9787)
|
||
|
||
*Effects*: Initializes the base class withbasic_iostream<charT, traits>(addressof(*sb*)) ([[iostream.cons]](iostream.cons "31.7.5.7.2 Constructors"))
|
||
and *sb* withbasic_stringbuf<charT, traits, Allocator>(s, which, a) ([[stringbuf.cons]](stringbuf.cons "31.8.2.2 Constructors"))[.](#5.sentence-1)
|
||
|
||
[ð](#lib:basic_stringstream,constructor_____)
|
||
|
||
`template<class SAlloc>
|
||
explicit basic_stringstream(
|
||
const basic_string<charT, traits, SAlloc>& s,
|
||
ios_base::openmode which = ios_base::out | ios_base::in);
|
||
`
|
||
|
||
[6](#6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L9804)
|
||
|
||
*Constraints*: is_same_v<SAlloc, Allocator> is false[.](#6.sentence-1)
|
||
|
||
[7](#7)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L9808)
|
||
|
||
*Effects*: Initializes the base class withbasic_iostream<charT, traits>(addressof(*sb*)) ([[iostream.cons]](iostream.cons "31.7.5.7.2 Constructors"))
|
||
and *sb* withbasic_stringbuf<charT, traits, Allocator>(s, which) ([[stringbuf.cons]](stringbuf.cons "31.8.2.2 Constructors"))[.](#7.sentence-1)
|
||
|
||
[ð](#lib:basic_stringstream,constructor______)
|
||
|
||
`template<class T>
|
||
explicit basic_stringstream(const T& t, ios_base::openmode which = ios_base::out | ios_base::in);
|
||
template<class T>
|
||
basic_stringstream(const T& t, const Allocator& a);
|
||
template<class T>
|
||
basic_stringstream(const T& t, ios_base::openmode which, const Allocator& a);
|
||
`
|
||
|
||
[8](#8)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L9827)
|
||
|
||
Let which be ios_base::out | ios_base::in for the overload with no parameter which, anda be Allocator() for the overload with no parameter a[.](#8.sentence-1)
|
||
|
||
[9](#9)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L9832)
|
||
|
||
*Constraints*: is_convertible_v<const T&, basic_string_view<charT, traits>> is true[.](#9.sentence-1)
|
||
|
||
[10](#10)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L9837)
|
||
|
||
*Effects*: Initializes the base class with addressof(*sb*), and
|
||
direct-non-list-initializes *sb* with t, which, a[.](#10.sentence-1)
|
||
|
||
[ð](#lib:basic_stringstream,constructor_______)
|
||
|
||
`basic_stringstream(basic_stringstream&& rhs);
|
||
`
|
||
|
||
[11](#11)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L9849)
|
||
|
||
*Effects*: Move constructs from the rvalue rhs[.](#11.sentence-1)
|
||
|
||
This
|
||
is accomplished by move constructing the base class, and the containedbasic_stringbuf[.](#11.sentence-2)
|
||
|
||
Then calls basic_istream<charT, traits>::set_rdbuf(addressof(*sb*)) to install the contained basic_stringbuf[.](#11.sentence-3)
|