[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: swap in stdlib?
From: |
Paul Pluzhnikov |
Subject: |
Re: swap in stdlib? |
Date: |
Sun, 26 Feb 2006 19:47:31 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) |
schuelaw@gmail.com 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.