std::istream
에서 operator>>
을 사용하여 읽는 방법은 무엇입니까?std :: istream (연산자 >> 사용)에서 어떻게 읽습니까?
void foo(const std::istream& in) {
std::string tmp;
while(in >> tmp) {
std::cout << tmp;
}
}
하지만 오류를 제공합니다 :
error: no match for 'operator>>' in 'in >> tmp'
IStream을가 시작을위한 const를하지 않아야합니다. istream 객체의 상태는 데이터를 꺼내서 변경해야합니다. –