Probleme mit std::map und std::fstream
-
Hi
ich versuche gerade einen platformunäbhangigen INI Parser zu Proggen und bin auch schon fast fertig.
ich habe nur noch das Problem das ich diese letzten Compiler Errors nicht verstehe,
die ich zu folgendem code kriege(Ich habe VC2003):CODE:
// parserini.cpp //Z.85 this->keys.push_back(std::pair<std::basic_string<char_t>, bool>(key, is_key)); //Z. 86 typedef (std::map< std::pair< std::basic_string<char_t>, std::basic_string<char_t> > >::iterator) map_iter_t; //Z. 87 map_iter_t ins_pos; //Z.88 ins_pos = data.find(std::pair<std::basic_string<char_t>, std::basic_string<char_t> >(section, key)); //Z.89 this->data.insert(ins_pos, value);(char_t ist ein typedef für char)
COMPILER ERRORS
\INI\parserini.cpp(86): error C2976: 'std::map' : too few template arguments \INI\parserini.cpp(86): error C2955: 'std::map' : use of class template requires template argument list \INI\parserini.cpp(86): error C2275: 'std::map<_Kty,_Ty,_Pr,_Alloc>::iterator' : illegal use of this type as an expression \INI\parserini.cpp(86): error C2146: syntax error : missing ';' before identifier 'map_iter_t' \INI\parserini.cpp(86): error C2065: 'map_iter_t' : undeclared identifier \INI\parserini.cpp(87): error C2146: syntax error : missing ';' before identifier 'ins_pos' \INI\parserini.cpp(87): error C3861: 'map_iter_t': identifier not found, even with argument-dependent lookup \INI\parserini.cpp(87): error C2065: 'ins_pos' : undeclared identifier \INI\parserini.cpp(88): error C3861: 'ins_pos': identifier not found, even with argument-dependent lookup \INI\parserini.cpp(89): error C3861: 'ins_pos': identifier not found, even with argument-dependent lookup \file.cpp(73): error C2558: class 'std::basic_fstream<_Elem,_Traits>' : no copy constructor available or copy constructor is declared 'explicit' with [ _Elem=char, _Traits=std::char_traits<char> ]Der Letzte Error bezieht sich auf die Funktion
std::basic_fstream<char_t> File::get_stream() { return this->stream; }Kann mir jemand helfen?
Mfg Shade37337
-
http://www.sgi.com/tech/stl/Map.html
Es mussstd::map<std::basic_string<char_t>, std::basic_string<char_t> >heißen.
Mach bezüglich des zweiten Fehlers aus den Rückgabeparameter eine Referenz, Streams sind nicht kopierbar (was dir der Compiler auch mitteilt!).
-
mein key_type der map is aber ein std::pair<std::basic_string<char_t>,std::basic_string<char_t> >
danke aber nochma wegen der fstream prob lösung
Mfg Shade37337
-
Und was ist der value_type der Map? Der muss immer angegeben sein.
-
ein std::basic_string<char_t>
siehe hier:Shade37337 schrieb:
//Z. 86
typedef (std::map< std::pair< std::basic_string<char_t>, std::basic_string<char_t> > >::iterator) map_iter_t;
-
Dann bitte:
std::map<std::pair<std::basic_string<char_t>, std::basic_string<char_t> >, std::basic_string<char_t> >Bitte auf Hinweise reagieren

-
waarum da bitte ohne prefix std:: ?
Mfg Shade37337
-
aso..jetz erst gesehen...
danke fürs aufmerksammachen...Mfg Shade37337