문제

std::string str;
std::stringstream strm(str);

이 오류가 발생합니다.

오류 11 오류 C2248 : 'std :: basic_ios <_elem, _traits> :: basic_ios': 클래스에서 개인 멤버에 액세스 할 수 없음 'std :: basic_ios <_elem, _traits>'c : program files microsoft Visual Studio 9.0 VC include sstream 517

iStringstream을 사용하면 마찬가지입니다.

컴파일러 : Visual C ++ 2008.

도움이 되었습니까?

해결책

스트림을 복사하려고하는 것 같습니다. 사본 생성자가 비공개이므로 불가능합니다.

다른 팁

#include <string>
#include <sstream>

int main( int argc, char *argv[] ) {
    std::string str;
    std::stringstream strm( str );

    return 0;
}

2008 년 대 오류/경고없이 잘 컴파일합니다. 전체 코드를 게시 할 수 있습니까?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top