This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: iostream question
On Wed, Oct 16, 2002 at 08:52:53PM -0400, Robert Schweikert wrote:
> OK,
>
> Are you saying I can no longer forward declare an ostream?
Yes, but you don't want to forward declare an ostream anymore.
class ostream;
isn't legal, because it doesn't match the real ostream.
> That would mean that for a declaration like so
>
> ostream& operator<< (ostream&, const myClass);
>
> I have to include the iostream header file in my header file. That seems
> odd. There's got to be a better way.
There is, called <iosfwd>. All the I/O classes, forward declared.
Phil
--
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
- Edsger Dijkstra, 1930-2002