I’m temporarily using gcc 2.95.2, and instead of having a sstream header, it defines a (slightly different, and deprecated) strstream. I’m currently getting around this with
#if __GNUC__ < 3 // or whatever version number it changes #include <strstream> #else #include <sstream> #endif
and then things like:
#if __GNUC__ < 3 strstream str; str << 'Hello World'; #else stringstream str('Hello World'); #endif
but it’s getting really annoying. I just want to make sure that when I switch back to a more recent gcc (or some other compiler), I don’t have to rewrite these passages. Any thoughts?
Create
mystream.hasThen use
mystream.hheader andmystreamtype instead.If you really want to make it look like modern sstream, you can create a new class manually (with the help of newer std c++ library source code or manually creating a proxy class that uses strstream as the underlying way to work).