]> www.ginac.de Git - ginac.git/commitdiff
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 0e67ec9a4e60733293d51db65c3e13f1d1751ade..e6bd91a7a98d0d38e0e83df4eca909063a9bdc7f 100644 (file)
@@ -715,8 +715,8 @@ void expairseq::construct_from_2_expairseq(const expairseq &s1,
        }
        
        if (needs_further_processing) {
        }
        
        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));
        }
 }
                construct_from_epvector(std::move(v));
        }
 }
@@ -776,8 +776,8 @@ void expairseq::construct_from_expairseq_ex(const expairseq &s,
        }
 
        if (needs_further_processing) {
        }
 
        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));
        }
 }
                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) {
                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));
        }
 }
                construct_from_epvector(std::move(v));
        }
 }
index 52a1f1b423cd4b3eafea7a3b8c6d8a185565d26c..2217bae85a3f4e64816d98bb4e70945959eba1c3 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);
                                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;
        }
        
        return det;