istreambuf_iterator::operator*
取值運算子傳回資料流的下一個字元。
CharType operator*( ) const;
傳回值
在資料流的下一個字元。
範例
// istreambuf_iterator_operator_deref.cpp
// compile with: /EHsc
#include <iterator>
#include <iostream>
int main( )
{
using namespace std;
cout << "Type string of characters & enter to output it,\n"
<< " with stream buffer iterators,(try: 'I'll be back.')\n"
<< " repeat as many times as desired,\n"
<< " then keystroke ctrl-Z Enter to exit program: ";
istreambuf_iterator<char> inpos ( cin );
istreambuf_iterator<char> endpos;
ostreambuf_iterator<char> outpos ( cout );
while ( inpos != endpos )
{
*outpos = *inpos; //Put value of outpos equal to inpos
++inpos;
++outpos;
}
}
我會傳回。
FakePre-aba37f3cbe7f4b088527cfb94dc5b858-adce06ba953c450e902b5f6680827d9b
需求
標頭:<迭代器>
命名空間: std