標準ライブラリヘッダー <strstream> (C++98 で非推奨)(C++26 で削除)
From cppreference.com
このヘッダーは入出力ライブラリの一部です。
クラス | ||
| (C++98で非推奨)(C++26で削除) |
生の文字配列デバイスを実装する (クラス) | |
| (C++98で非推奨)(C++26で削除) |
文字配列入力操作を実装する (クラス) | |
| (C++98で非推奨)(C++26で削除) |
文字配列出力操作を実装する (クラス) | |
| (C++98で非推奨)(C++26で削除) |
文字配列入出力操作を実装する (クラス) | |
[編集] 注釈
<strstream> は C++98 で非推奨になり、C++26 で削除されました (詳細は P2867R1 を参照)。
削除の理由は、C++20 および C++23 が、std::stringstream から文字列を効率的に移動する機能 (C++20 以降、詳細は P0408R7 を参照) や、<spanstream> ライブラリ (C++23 以降、詳細は P0448R4 を参照) など、より優れた代替機能を提供しているためです。
[編集] 概要
namespace std { class strstreambuf; class istrstream; class ostrstream; class strstream; }
[編集] クラス std::strstreambuf
namespace std { class strstreambuf : public basic_streambuf<char> { public: strstreambuf() : strstreambuf(0) {} explicit strstreambuf(streamsize alsize_arg); strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*)); strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr); strstreambuf(const char* gnext_arg, streamsize n); strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = nullptr); strstreambuf(const signed char* gnext_arg, streamsize n); strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = nullptr); strstreambuf(const unsigned char* gnext_arg, streamsize n); virtual ~strstreambuf(); void freeze(bool freezefl = true); char* str(); int pcount(); protected: int_type overflow (int_type c = EOF) override; int_type pbackfail(int_type c = EOF) override; int_type underflow() override; pos_type seekoff(off_type off, ios_base::seekdir way, ios_base::openmode which = ios_base::in | ios_base::out) override; pos_type seekpos(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out) override; streambuf* setbuf(char* s, streamsize n) override; private: using strstate = /*bitmask type*/; // exposition only static const strstate allocated; // exposition only static const strstate constant; // exposition only static const strstate dynamic; // exposition only static const strstate frozen; // exposition only strstate strmode; // exposition only streamsize alsize; // exposition only void* (*palloc)(size_t); // exposition only void (*pfree)(void*); // exposition only }; }
[編集] クラス std::istrstream
namespace std { class istrstream : public basic_istream<char> { public: explicit istrstream(const char* s); explicit istrstream(char* s); istrstream(const char* s, streamsize n); istrstream(char* s, streamsize n); virtual ~istrstream(); strstreambuf* rdbuf() const; char* str(); private: strstreambuf sb; // exposition only }; }
[編集] クラス std::ostrstream
namespace std { class ostrstream : public basic_ostream<char> { public: ostrstream(); ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out); virtual ~ostrstream(); strstreambuf* rdbuf() const; void freeze(bool freezefl = true); char* str(); int pcount() const; private: strstreambuf sb; // exposition only }; }
[編集] クラス std::strstream
namespace std { class strstream : public basic_iostream<char> { public: // types using char_type = char; using int_type = char_traits<char>::int_type; using pos_type = char_traits<char>::pos_type; using off_type = char_traits<char>::off_type; // constructors/destructor strstream(); strstream(char* s, int n, ios_base::openmode mode = ios_base::in | ios_base::out); virtual ~strstream(); // members strstreambuf* rdbuf() const; void freeze(bool freezefl = true); int pcount() const; char* str(); private: strstreambuf sb; // exposition only }; }