stringstream bug in VC9? “Cannot access private member”
-
06-07-2019 - |
Question
std::string str;
std::stringstream strm(str);
I get this error:
Error 11 error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>' c:\program files\microsoft visual studio 9.0\vc\include\sstream 517
If I use istringstream, same happens.
Compiler: Visual C++ 2008.
Solution
Sounds like you are trying to copy a stream. This is not possible as the copy constructors are private.
OTHER TIPS
#include <string>
#include <sstream>
int main( int argc, char *argv[] ) {
std::string str;
std::stringstream strm( str );
return 0;
}
Compiles fine with no errors/warnings for me in VS 2008. Can you post the full code?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow