ios_base::xalloc
Specifies that a variable is part of the stream.
static int xalloc( );
반환 값
The static member function returns a stored static value, which it increments on each call.
설명
You can use the return value as a unique index argument when calling the member functions iword or pword.
예제
// ios_base_xalloc.cpp
// compile with: /EHsc
// Lets you store user-defined information.
// iword, jword, xalloc
#include <iostream>
int main( )
{
using namespace std;
static const int i = ios_base::xalloc();
static const int j = ios_base::xalloc();
cout.iword( i ) = 11;
cin.iword( i ) = 13;
cin.pword( j ) = "testing";
cout << cout.iword( i ) << endl;
cout << cin.iword( i ) << endl;
cout << ( char * )cin.pword( j ) << endl;
}
요구 사항
Header: <ios>
네임스페이스: std