bug stringstream in VC9? & # 8220; Impossibile accedere al membro privato & # 8221;
-
06-07-2019 - |
Domanda
std::string str;
std::stringstream strm(str);
Ottengo questo errore:
Errore 11 errore C2248: 'std :: basic_ios < _Elem, _Traits > :: basic_ios' : impossibile accedere al membro privato dichiarato in classe 'std :: basic_ios < _Elem, _Traits >' C: \ Program files \ microsoft visual studio 9.0 \ vc \ include \ sstream 517
Se uso istringstream, succede lo stesso.
Compilatore: Visual C ++ 2008.
Soluzione
Sembra che tu stia provando a copiare uno stream. Ciò non è possibile poiché i costruttori di copie sono privati.
Altri suggerimenti
#include <string>
#include <sstream>
int main( int argc, char *argv[] ) {
std::string str;
std::stringstream strm( str );
return 0;
}
Compila bene senza errori / avvisi per me in VS 2008. Puoi pubblicare il codice completo?
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow