[EMAIL PROTECTED] writes:

> Thanks for this.  I'm beginning to understand a bit more.  Just to
> clarify (if you will), I notice that the original program that raised
> this issue had an #include <iostream> at the top because the student
> was using cout.  If I remove that line, then the swap function becomes
> unrecognized.  So for some reason, iostream is prototyping swap either
> directly or indirectly.  Do you happen to know why iostream needs swap?

iostream probably doesn't need swap(), but it does (indirectly)
need stl_algobase.h, and swap() is one of many things provided
by stl_algobase.h.

Here is how stl_algobase.h ends up in the compilation unit (using
gcc-3.3.3 on my machine, abridged 'g++ -H' output):

. /usr/include/c++/3.3.3/iostream
.. /usr/include/c++/3.3.3/ostream
... /usr/include/c++/3.3.3/ios
.... /usr/include/c++/3.3.3/bits/ios_base.h
..... /usr/include/c++/3.3.3/bits/locale_classes.h
...... /usr/include/c++/3.3.3/string
....... /usr/include/c++/3.3.3/memory
........ /usr/include/c++/3.3.3/bits/stl_algobase.h

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
_______________________________________________
Help-gplusplus mailing list
Help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to