[PPL-devel] [GIT] ppl/ppl(sparse_matrices): Unlimited_Sparse_Row_Custom_Slist_Backend: fix splice() so assert() does not fail.

Marco Poletti poletti.marco at gmail.com
Sun Mar 7 10:36:55 CET 2010


Module: ppl/ppl
Branch: sparse_matrices
Commit: 22b762aa0e5a8a19a7e16c830a31f4018e5b165f
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=22b762aa0e5a8a19a7e16c830a31f4018e5b165f

Author: Marco Poletti <poletti.marco at gmail.com>
Date:   Sun Mar  7 10:22:49 2010 +0100

Unlimited_Sparse_Row_Custom_Slist_Backend: fix splice() so assert() does not fail.

---

 ...ited_Sparse_Row_Custom_Slist_Backend.inlines.hh |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/Unlimited_Sparse_Row_Custom_Slist_Backend.inlines.hh b/src/Unlimited_Sparse_Row_Custom_Slist_Backend.inlines.hh
index 730a5d6..aa222fd 100644
--- a/src/Unlimited_Sparse_Row_Custom_Slist_Backend.inlines.hh
+++ b/src/Unlimited_Sparse_Row_Custom_Slist_Backend.inlines.hh
@@ -181,8 +181,11 @@ Unlimited_Sparse_Row_Custom_Slist_Backend::splice(
     x.last = i.p;
   to_move->next = *(position.p);
   *(position.p) = to_move;
-  // i_itr points to the moved element.
   dangerous_iterator i_itr = position;
+#ifndef NDEBUG
+  i_itr.q = *(i_itr.p);
+#endif
+  // i_itr points to the moved element.
   position.p = &(to_move->next);
 #ifndef NDEBUG
   position.q = *(position.p);
@@ -219,8 +222,11 @@ Unlimited_Sparse_Row_Custom_Slist_Backend::splice(
     // We moved some elements from the end of x, so x.last must be updated.
     x.last = first1.p;
   *(last1.p) = tail;
-  // first_itr points to the first added element
   dangerous_iterator first_itr = position;
+#ifndef NDEBUG
+  first_itr.q = *(first_itr.p);
+#endif
+  // first_itr points to the first added element
   position.p = last1.p;
 #ifndef NDEBUG
   position.q = *(position.p);




More information about the PPL-devel mailing list