[PPL-devel] [GIT] ppl/ppl(sparse_matrices): Unlimited_Sparse_Row: fixed swap().
Marco Poletti
poletti.marco at gmail.com
Thu Mar 4 21:54:58 CET 2010
Module: ppl/ppl
Branch: sparse_matrices
Commit: ce05ab69d64f01235b43782219f9d15d2687f955
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=ce05ab69d64f01235b43782219f9d15d2687f955
Author: Marco Poletti <poletti.marco at gmail.com>
Date: Thu Mar 4 21:51:13 2010 +0100
Unlimited_Sparse_Row: fixed swap().
---
src/Unlimited_Sparse_Row.inlines.hh | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/Unlimited_Sparse_Row.inlines.hh b/src/Unlimited_Sparse_Row.inlines.hh
index 0ee45dc..268ef17 100644
--- a/src/Unlimited_Sparse_Row.inlines.hh
+++ b/src/Unlimited_Sparse_Row.inlines.hh
@@ -58,10 +58,10 @@ Unlimited_Sparse_Row::swap(dimension_type i, dimension_type j) {
} else {
if (i_itr != j_itr) {
// i is in the list, j isn't
- j_itr = data.splice(j_itr,data,i_itr);
- // i_itr is no longer valid.
- // j_itr now points to the moved element.
- j_itr->first = j;
+ i_itr = data.splice(j_itr,data,i_itr);
+ // i_itr was invalidated.
+ // Now i_itr points to the moved element.
+ i_itr->first = j;
} else {
j_itr->first=j;
}
@@ -70,10 +70,10 @@ Unlimited_Sparse_Row::swap(dimension_type i, dimension_type j) {
if (j_itr != itr_end && j_itr->first == j) {
if (i_itr != j_itr) {
// j is in the list, i isn't
- i_itr = data.splice(i_itr,data,j_itr);
- // j_itr is no longer valid.
- // i_itr now points to the moved element.
- i_itr->first = i;
+ j_itr = data.splice(i_itr,data,j_itr);
+ // j_itr was invalidated.
+ // Now j_itr points to the moved element.
+ j_itr->first = i;
} else {
i_itr->first = j;
}
More information about the PPL-devel
mailing list