Avoid some explicit copying of STL containers.
authorRichard Kreckel <kreckel@ginac.de>
Tue, 24 Nov 2015 10:57:35 +0000 (11:57 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Tue, 24 Nov 2015 10:57:35 +0000 (11:57 +0100)
ginac/expairseq.cpp
ginac/matrix.cpp

index 0e67ec9..e6bd91a 100644 (file)
@@ -715,8 +715,8 @@ void expairseq::construct_from_2_expairseq(const expairseq &s1,
        }
        
        if (needs_further_processing) {
-               epvector v = seq;
-               seq.clear();
+               // Clear seq and start over.
+               epvector v = std::move(seq);
                construct_from_epvector(std::move(v));
        }
 }
@@ -776,8 +776,8 @@ void expairseq::construct_from_expairseq_ex(const expairseq &s,
        }
 
        if (needs_further_processing) {
-               epvector v = seq;
-               seq.clear();
+               // Clear seq and start over.
+               epvector v = std::move(seq);
                construct_from_epvector(std::move(v));
        }
 }
@@ -964,8 +964,8 @@ void expairseq::combine_same_terms_sorted_seq()
                seq.erase(itout,last);
 
        if (needs_further_processing) {
-               epvector v = seq;
-               seq.clear();
+               // Clear seq and start over.
+               epvector v = std::move(seq);
                construct_from_epvector(std::move(v));
        }
 }
index 52a1f1b..2217bae 100644 (file)
@@ -1221,9 +1221,8 @@ ex matrix::determinant_minor() const
                                for (unsigned j=fc; j<n-c; ++j)
                                        Pkey[j] = Pkey[j-1]+1;
                } while(fc);
-               // next column, so change the role of A and B:
-               A.swap(B);
-               B.clear();
+               // next column, clear B and change the role of A and B:
+               A = std::move(B);
        }
        
        return det;