summaryrefslogtreecommitdiff
path: root/include/phat/representations/vector_vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/phat/representations/vector_vector.h')
-rw-r--r--include/phat/representations/vector_vector.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/include/phat/representations/vector_vector.h b/include/phat/representations/vector_vector.h
index da8ec5a..4aee533 100644
--- a/include/phat/representations/vector_vector.h
+++ b/include/phat/representations/vector_vector.h
@@ -83,11 +83,18 @@ namespace phat {
column& source_col = matrix[ source ];
column& target_col = matrix[ target ];
column& temp_col = temp_column_buffer();
- temp_col.clear();
- std::set_symmetric_difference( target_col.begin(), target_col.end(),
+
+
+ size_t new_size = source_col.size() + target_col.size();
+
+ if (new_size > temp_col.size()) temp_col.resize(new_size);
+
+ std::vector<index>::iterator col_end = std::set_symmetric_difference( target_col.begin(), target_col.end(),
source_col.begin(), source_col.end(),
- std::back_inserter( temp_col ) );
- //target_col.swap( temp_col );
+ temp_col.begin() );
+ temp_col.erase(col_end, temp_col.end());
+
+
target_col = temp_col;
temp_col.clear();
}