Vorab:
DANKE! Die Ausgabe ansich funktioniert nun. In der Version mit dem "normalen" int_type geht für Vc++ auch alles wunderbar. Aber leider ist da noch der gcc
Wenn ich das "int_type" wie von dir vorgeschlagen auflöse, hauen mich sowohl VC++ als auch der gcc mit Fehlern. Am Rande: Der "Vorschlag" vom gcc löst das Problem auch nicht, das hatte ich schon länger probiert (aber nie hier erwähnt).
Dann noch eine allgemeine Frage: int_type taucht in der Methode sowohl als Rückgabetyp als auch als Parametertyp auf. Ich gehe davon aus, dass ich beide ersetzen soll? So sieht der Code gerade bei mir aus:
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
|
virtual std::basic_streambuf< _elem, _traits >::int_type overflow( std::basic_streambuf< _elem, _traits >::int_type c = _traits::eof() )
{
if (_traits::eq_int_type(c, _traits::eof()))
return _traits::not_eof(c);
const char cc = _traits::to_char_type( c );
return (_traits::eq_int_type( m_first->sputc(cc), _traits::eof() )
|| _traits::eq_int_type( m_second->sputc(cc), _traits::eof() ))? _traits::eof(): _traits::not_eof(c);
}
|
Fehler vom VS:
|
Quellcode
|
1
2
3
4
5
6
7
8
|
Warnung 1 warning C4346: 'std::basic_streambuf<_Elem,_Traits>::int_type': Abhängiger Name ist kein Typ
Fehler 2 error C2146: Syntaxfehler: Fehlendes ';' vor Bezeichner 'overflow'
Warnung 3 warning C4346: 'std::basic_streambuf<_Elem,_Traits>::int_type': Abhängiger Name ist kein Typ
Fehler 4 error C2061: Syntaxfehler: Bezeichner 'int_type'
Fehler 5 error C2059: Syntaxfehler: ')'
Fehler 6 error C2143: Syntaxfehler: Es fehlt ')' vor '{'
Fehler 7 error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht unterstützt.
Warnung 8 warning C4183: 'overflow': Rückgabetyp fehlt; Memberfunktion, die 'int' zurückgibt wird angenommen
|
Und vom gcc
|
Quellcode
|
1
2
3
4
|
Output.h:22: error: ISO C++ forbids declaration of `int_type' with no type
Output.h:22: error: cannot declare member `std::basic_streambuf<_CharT, _Traits>::int_type' within `WoRD::Output<_elem, _traits>'
Output.h:22: error: expected `;' before "overflow"
Output.h:30: error: expected `;' before "public"
|