summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorjan.reininghaus <jan.reininghaus@8e3bb3c2-eed4-f18f-5264-0b6c94e6926d>2013-04-23 15:27:41 +0000
committerjan.reininghaus <jan.reininghaus@8e3bb3c2-eed4-f18f-5264-0b6c94e6926d>2013-04-23 15:27:41 +0000
commit33e15d6aa9d5cfd1a51f740e2e743b9f9b5ffb0b (patch)
treebf9aa600e36125ffce8fdff9a9ff5106ec2bb206 /include
parent7b96eb822cf02b5d92905f0ab732e977b4dd0e7c (diff)
performance improvement for vector_vector
git-svn-id: https://phat.googlecode.com/svn/trunk@42 8e3bb3c2-eed4-f18f-5264-0b6c94e6926d
Diffstat (limited to 'include')
-rw-r--r--include/phat/representations/vector_vector.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/phat/representations/vector_vector.h b/include/phat/representations/vector_vector.h
index c313c20..bdef522 100644
--- a/include/phat/representations/vector_vector.h
+++ b/include/phat/representations/vector_vector.h
@@ -80,8 +80,9 @@ namespace phat {
void _add_to( index source, index target ) {
column& source_col = matrix[ source ];
column& target_col = matrix[ target ];
- column temp_col = target_col;
- target_col.clear();
+ column temp_col;
+ target_col.swap( temp_col );
+ target_col.reserve( temp_col.size() );
std::set_symmetric_difference( temp_col.begin(), temp_col.end(),
source_col.begin(), source_col.end(),
std::back_inserter( target_col ) );