Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2001-10-10 19:03:05


On Wednesday, October 10, 2001, at 08:04 PM, David Abrahams wrote:

> Now, about the issue of not being able to /construct/ a
> basic_ostringstream
> without including <ostream>, my instincts lead me in the other
> direction.

Umm... and <ios> for basic_ios, yet another templated base class of
basic_ostringstream. :-)

> Still in all, if you want to declare a function taking a
> basic_ostringstream&, should you have to compile the definition of
> ostream?

Depending on what you do with the function, maybe, maybe not.
basic_ostringstream is forward declared in <iosfwd>. So maybe you can
get away with just that.

In summary, I would like to see the following code be portable:

#include <sstream>

int main()
{
        std::ostringstream s;
        s << "hi";
}

Additionally, it would be nice if we had some generalized rules that
said /why/ this is portable code, instead of just saying: well,
<sstream> will include <ostream> and <ios> and whatever else is
necessary to make this work. Maybe the paragraph I proposed eariler
isn't the correct generalized rule. But I would like to see something
like that; fairly easy to understand, and generally applicable.

-Howard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk