2009-06-21 80 views
0
std::string str; 
std::stringstream strm(str); 

我得到这个错误:VC9中的stringstream错误? “无法访问私有成员”

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

如果我使用istringstream,同样的情况。

编译:VISUAL C++ 2008

回答

2

听起来就像你试图复制一个流。这是不可能的,因为复制构造函数是私有的。

+0

是的。和VC9没有链接到正确的代码,我试图做这样的事情: boost :: archive :: xml_iarchive xml(GetStream(igFilePath)); 其中GetStream将复制字符串流。 好的,STL! – mannicken 2009-06-21 05:08:23

7
#include <string> 
#include <sstream> 

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

    return 0; 
} 

编译正常,没有错误/我在VS 2008,你能张贴的完整代码的警告?

相关问题