summaryrefslogtreecommitdiff
path: root/utils/batched_append.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/batched_append.h')
-rwxr-xr-xutils/batched_append.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/utils/batched_append.h b/utils/batched_append.h
index 842f3209..fe4a12fc 100755
--- a/utils/batched_append.h
+++ b/utils/batched_append.h
@@ -11,6 +11,7 @@ void batched_append(Vector &v,SRange const& s) {
v.insert(v.end(),s.begin(),s.end());
}
+//destroys input s, but moves its resources to the end of v. //TODO: use move ctor in c++0x
template <class SRange,class Vector>
void batched_append_swap(Vector &v,SRange & s) {
using namespace std; // to find the right swap via ADL
@@ -20,6 +21,7 @@ void batched_append_swap(Vector &v,SRange & s) {
typename SRange::iterator si=s.begin();
for (;i<news;++i,++si)
swap(v[i],*si);
+ s.clear();
}
#endif