JustSomeGuy wrote:
Ok I tried including <ostream> that didn't help...
however delving deeper into this class I found that it is inheriting
from std::streambuf and has a overflow method... and I'm thinking that
somehow to_char_type is not being called somehow.
The hard part of bugfixing is when you have more than one bug.
Anyway, you must have mistracked somewhere. ostream doesn't have
an IS-A relation with streambut, but a HAS-A. This is important,
because you can replace that streambuf at runtime. std::cout
will have a special one that streams to the screen.
Anyway, the tricky part with the int_type is to deal with the number
of possible results when trying to get a character. There are
typically 257 results: either one of 256 characters, or EOF (-1).
That won't fit in an char, so an int is used. Streams are templatized
(work on wchar as well) and that's why you can't use int directly.
Anyway, the mapping from int to char (and to wchar_t from whatever
it maps from) is done by to_char_type. That is pretty much a no-op,
and I can't imagine that failing.
Regards,
Michiel Salters