Namespaces
Variants

Standard library header <strstream> (deprecated in C++98) (removed in C++26)

From cppreference.net
Standard library headers

이 헤더는 Input/Output 라이브러리의 일부입니다.

목차

클래스

(C++98에서 사용 중단됨) (C++26에서 제거됨)
원시 문자 배열 장치 구현
(클래스)
(C++98에서 사용 중단됨) (C++26에서 제거됨)
문자 배열 입력 연산 구현
(클래스)
(C++98에서 사용 중단됨) (C++26에서 제거됨)
문자 배열 출력 연산 구현
(클래스)
(C++98에서 사용 중단됨) (C++26에서 제거됨)
문자 배열 입출력 연산 구현
(클래스)

참고 사항

<strstream> 는 C++98에서 사용 중단(deprecated)되었으며 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 = /*비트마스크 타입*/;  // 설명 전용
    static const strstate allocated;    // 설명 전용
    static const strstate constant;     // 설명 전용
    static const strstate dynamic;      // 설명 전용
    static const strstate frozen;       // 설명 전용
    strstate strmode;                   // 설명 전용
    streamsize alsize;                  // 설명 전용
    void* (*palloc)(size_t);            // 설명 전용
    void (*pfree)(void*);               // 설명 전용
  };
}

클래스 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;            // 설명 전용
  };
}

클래스 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;            // 설명용으로만 사용
  };
}

클래스 std::strstream

namespace std {
  class strstream
    : public basic_iostream<char> {
  public:
    // 타입
    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;
    // 생성자/소멸자
    strstream();
    strstream(char* s, int n,
              ios_base::openmode mode = ios_base::in | ios_base::out);
    virtual ~strstream();
    // 멤버 함수
    strstreambuf* rdbuf() const;
    void freeze(bool freezefl = true);
    int pcount() const;
    char* str();
  private:
    strstreambuf sb;            // 설명 전용
  };
}