0

この質問は私の以前の質問に関連しています。以下のコードを使用して、 にstreambuf関連付けられたオブジェクトの値を調べましたcout。VS2010 IDE を使用すると、このクラスにいくつかのメンバーが表示されます。これらのメンバーのどれがメモリ内の cout の null バッファを指しているのか、誰か教えてもらえますか?

#include <iostream>

int main()
{
    std::streambuf* p = std::cout.rdbuf();  
}

編集:streambufヘッダー ファイルを見ると、basic_streambufクラス内に次のプライベート メンバーが見つかります。

    _Mutex _Mylock; // thread lock
    _Elem *_Gfirst; // beginning of read buffer
    _Elem *_Pfirst; // beginning of write buffer
    _Elem **_IGfirst;   // pointer to beginning of read buffer
    _Elem **_IPfirst;   // pointer to beginning of write buffer
    _Elem *_Gnext;  // current position in read buffer
    _Elem *_Pnext;  // current position in write buffer
    _Elem **_IGnext;    // pointer to current position in read buffer
    _Elem **_IPnext;    // pointer to current position in write buffer

    int _Gcount;    // length of read buffer
    int _Pcount;    // length of write buffer
    int *_IGcount;  // pointer to length of read buffer
    int *_IPcount;  // pointer to length of write buffer

    locale *_Plocale;   // pointer to imbued locale object

_Pfirst探しているアドレスだと思いますが、予想どおり NULL です。

4

0 に答える 0