:차이 이제 stringstream 및 ostringstream
#include<iostream>
#include<sstream>
using namespace std;
void MyPrint(ostream& stream)
{
cout<<stream.rdbuf()<< endl;
}
int main()
{
stringstream ss;
ss<<"hello there";
MyPrint(ss); //Prints fine
ostringstream oss;
oss<<"hello there";
MyPrint(oss); //Does not print anything
getchar();
}
내가 stringstream
과 ostringstream
사이에 유일하게 가능한 차이가 있음을 알고를 그 후에 힘 방향과 stringstream
보다 약간 빠릅니다.
나는 무엇을 놓치고 있습니까?
추신 : 비슷한 질문이 이전에 게시되었지만 답변을 얻지 못했습니다.