From cppreference.com
This header is part of the
library.
Classes
(deprecated in C++98)(removed in C++26)
implements raw character array device
(class)
(deprecated in C++98)(removed in C++26)
implements character array input operations
(class)
(deprecated in C++98)(removed in C++26)
implements character array output operations
(class)
(deprecated in C++98)(removed in C++26)
implements character array input/output operations
(class)
Notes
<strstream> is deprecated in C++98 and removed in C++26 (see
).
The reason for removal is that C++20 and C++23 provide superior replacement facilities, such as the ability to move strings efficiently out of
s (since C++20, see
), and the
library (since C++23, see
).
Synopsis
namespacestd{classstrstreambuf;classistrstream;classostrstream;classstrstream;}Class
namespacestd{classstrstreambuf:publicbasic_streambuf<char>{public:strstreambuf():strstreambuf(0){}explicitstrstreambuf(streamsizealsize_arg);strstreambuf(void*(*palloc_arg)(size_t),void(*pfree_arg)(void*));strstreambuf(char*gnext_arg,streamsizen,char*pbeg_arg=nullptr);strstreambuf(constchar*gnext_arg,streamsizen);strstreambuf(signedchar*gnext_arg,streamsizen,signedchar*pbeg_arg=nullptr);strstreambuf(constsignedchar*gnext_arg,streamsizen);strstreambuf(unsignedchar*gnext_arg,streamsizen,unsignedchar*pbeg_arg=nullptr);strstreambuf(constunsignedchar*gnext_arg,streamsizen);virtual~strstreambuf();voidfreeze(boolfreezefl=true);char*str();intpcount();protected:int_typeoverflow(int_typec=EOF)override;int_typepbackfail(int_typec=EOF)override;int_typeunderflow()override;pos_typeseekoff(off_typeoff,ios_base::seekdirway,ios_base::openmodewhich=ios_base::in|ios_base::out)override;pos_typeseekpos(pos_typesp,ios_base::openmodewhich=ios_base::in|ios_base::out)override;streambuf*setbuf(char*s,streamsizen)override;private:usingstrstate=/*bitmask type*/;// exposition onlystaticconststrstateallocated;// exposition onlystaticconststrstateconstant;// exposition onlystaticconststrstatedynamic;// exposition onlystaticconststrstatefrozen;// exposition onlystrstatestrmode;// exposition onlystreamsizealsize;// exposition onlyvoid*(*palloc)(size_t);// exposition onlyvoid(*pfree)(void*);// exposition only};}Class
namespacestd{classistrstream:publicbasic_istream<char>{public:explicitistrstream(constchar*s);explicitistrstream(char*s);istrstream(constchar*s,streamsizen);istrstream(char*s,streamsizen);virtual~istrstream();strstreambuf*rdbuf()const;char*str();private:strstreambufsb;// exposition only};}Class
namespacestd{classostrstream:publicbasic_ostream<char>{public:ostrstream();ostrstream(char*s,intn,ios_base::openmodemode=ios_base::out);virtual~ostrstream();strstreambuf*rdbuf()const;voidfreeze(boolfreezefl=true);char*str();intpcount()const;private:strstreambufsb;// exposition only};}Class
namespacestd{classstrstream:publicbasic_iostream<char>{public:// typesusingchar_type=char;usingint_type=char_traits<char>::int_type;usingpos_type=char_traits<char>::pos_type;usingoff_type=char_traits<char>::off_type;// constructors/destructorstrstream();strstream(char*s,intn,ios_base::openmodemode=ios_base::in|ios_base::out);virtual~strstream();// membersstrstreambuf*rdbuf()const;voidfreeze(boolfreezefl=true);intpcount()const;char*str();private:strstreambufsb;// exposition only};}