Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2001-10-10 18:25:27


On Wednesday, October 10, 2001, at 07:12 PM, David Abrahams wrote:

> These two cases seem completely different to me. Does "getting
> ostringstream
> up and running" include the ability to stream /any/ type at all into it,
> regardless of whether the inserter is visible?
>
> #include <sstream>
> struct X;
> void f(ostringstream& s, X const& x)
> {
> s << x; // legal?
> }
>
> That would seem to me to be the analogous case.

Hmm... I'm not sure I'm completely following your thoughts. "Up and
running" in the context I used it meant being able to stream the
built-in type: string literal. And the analogy is that to do so you
have to implicitly use methods defined from another class in another
header, even though you don't explicitly mention the other class
(basic_ostream). (just like needing the string constructor without
mentioning std::string in the stdexcept example)

I don't believe your example above is legal because there is no
operator << in scope that will take an ostringstream on the left and an
X on the right.

Sorry, I know you've got a good point in here. But I guess I'm just
being slow this evening. Could you expound on your argument?

-Howard


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