44 lines
3.5 KiB
Markdown
44 lines
3.5 KiB
Markdown
[stringstream.general]
|
||
|
||
# 31 Input/output library [[input.output]](./#input.output)
|
||
|
||
## 31.8 String-based streams [[string.streams]](string.streams#stringstream.general)
|
||
|
||
### 31.8.5 Class template basic_stringstream [[stringstream]](stringstream#general)
|
||
|
||
#### 31.8.5.1 General [stringstream.general]
|
||
|
||
[ð](#lib:basic_stringstream)
|
||
|
||
namespace std {template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>class basic_stringstream : public basic_iostream<charT, traits> {public:using char_type = charT; using int_type = typename traits::int_type; using pos_type = typename traits::pos_type; using off_type = typename traits::off_type; using traits_type = traits; using allocator_type = Allocator; // [[stringstream.cons]](stringstream.cons "31.8.5.2 Constructors"), constructors basic_stringstream() : basic_stringstream(ios_base::out | ios_base::in) {}explicit basic_stringstream(ios_base::openmode which); explicit basic_stringstream(const basic_string<charT, traits, Allocator>& s,
|
||
ios_base::openmode which = ios_base::out | ios_base::in);
|
||
basic_stringstream(ios_base::openmode which, const Allocator& a); explicit basic_stringstream( basic_string<charT, traits, Allocator>&& s,
|
||
ios_base::openmode which = ios_base::out | ios_base::in); template<class SAlloc> basic_stringstream(const basic_string<charT, traits, SAlloc>& s, const Allocator& a): basic_stringstream(s, ios_base::out | ios_base::in, a) {}template<class SAlloc> basic_stringstream(const basic_string<charT, traits, SAlloc>& s,
|
||
ios_base::openmode which, const Allocator& a); template<class SAlloc>explicit basic_stringstream(const basic_string<charT, traits, SAlloc>& s,
|
||
ios_base::openmode which = ios_base::out | ios_base::in); 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);
|
||
basic_stringstream(const basic_stringstream&) = delete;
|
||
basic_stringstream(basic_stringstream&& rhs);
|
||
|
||
basic_stringstream& operator=(const basic_stringstream&) = delete;
|
||
basic_stringstream& operator=(basic_stringstream&& rhs); // [[stringstream.swap]](stringstream.swap "31.8.5.3 Swap"), swapvoid swap(basic_stringstream& rhs); // [[stringstream.members]](stringstream.members "31.8.5.4 Member functions"), members basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
|
||
|
||
basic_string<charT, traits, Allocator> str() const &; template<class SAlloc> basic_string<charT,traits,SAlloc> str(const SAlloc& sa) const;
|
||
basic_string<charT, traits, Allocator> str() &&;
|
||
basic_string_view<charT, traits> view() const noexcept; void str(const basic_string<charT, traits, Allocator>& s); template<class SAlloc>void str(const basic_string<charT, traits, SAlloc>& s); void str(basic_string<charT, traits, Allocator>&& s); template<class T>void str(const T& t); private: basic_stringbuf<charT, traits, Allocator> *sb*; // *exposition only*};}
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L9697)
|
||
|
||
The
|
||
class templatebasic_stringstream<charT, traits> supports reading and writing from objects of classbasic_string<charT, traits, Allocator>[.](#1.sentence-1)
|
||
|
||
It uses abasic_stringbuf<charT, traits, Allocator> object to control the associated sequence[.](#1.sentence-2)
|
||
|
||
For the sake of exposition, the maintained data is presented here as
|
||
|
||
- [(1.1)](#1.1)
|
||
|
||
*sb*, the stringbuf object[.](#1.sentence-3)
|