help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

swap in stdlib?


From: schuelaw
Subject: swap in stdlib?
Date: 26 Feb 2006 16:07:56 -0800
User-agent: G2/0.2

I just got finished teaching bubble sort to my intro programming class.
 The book they use, prints the algorithm with a swap() function,
instead of showing the actual swapping.  During class, I emphasized
that the "swap(x,y)" in the book was a function that they would have to
write since it was not part of the C++ language.  Well, I got an email
from a student over the weekend noting that in fact he did not need to
write a swap function for the bubble sort algorithm, that g++
recognized the swap function and that it did the right thing.

We're using the g++ in

gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)

Is a swap function part of "standard c++"?  If not, where can I read
about the implementation of this particular swap in this particular
compiler?

Thanks,

Albert



reply via email to

[Prev in Thread] Current Thread [Next in Thread]