Mercurial > hg > octave-terminal
changeset 14862:bbdc822be2b9
smyrcm.cc: use std::swap instead of custom swap code.
* symrcm.cc (H_heapify_min, H_insert, Fsymrcm): use std::swap instead of custom
swap code.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sat, 14 Jul 2012 09:59:41 -0700 |
parents | f7afecdd87ef |
children | 3a05cb67dea5 2309812f428e |
files | src/DLD-FUNCTIONS/symrcm.cc |
diffstat | 1 files changed, 3 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/symrcm.cc +++ b/src/DLD-FUNCTIONS/symrcm.cc @@ -135,9 +135,7 @@ if (smallest != j) { - CMK_Node tmp = A[j]; - A[j] = A[smallest]; - A[smallest] = tmp; + std::swap (A[j], A[smallest]); j = smallest; } else @@ -161,9 +159,7 @@ octave_idx_type p = PARENT(i); if (H[i].deg < H[p].deg) { - CMK_Node tmp = H[i]; - H[i] = H[p]; - H[p] = tmp; + std::swap (H[i], H[p]); i = p; } @@ -699,11 +695,7 @@ // compute the reverse-ordering s = N / 2 - 1; for (octave_idx_type i = 0, j = N - 1; i <= s; i++, j--) - { - double tmp = P.elem (i); - P.elem (i) = P.elem (j); - P.elem (j) = tmp; - } + std::swap (P.elem (i), P.elem (j)); // increment all indices, since Octave is not C return octave_value (P+1);