]> www.ginac.de Git - ginac.git/commitdiff
Add rvalue reference ctors from epvectors for add, mul.
authorRichard Kreckel <kreckel@ginac.de>
Thu, 17 Dec 2015 08:32:15 +0000 (09:32 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Thu, 17 Dec 2015 08:32:15 +0000 (09:32 +0100)
ginac/add.cpp
ginac/add.h
ginac/mul.cpp
ginac/mul.h

index 2a2e2f8310fa56217c4e52934f0399d76f7b3108..79994e11c5ddf47e54b84daf883b014b1f1410a4 100644 (file)
@@ -86,6 +86,13 @@ add::add(const epvector & v, const ex & oc)
        GINAC_ASSERT(is_canonical());
 }
 
+add::add(epvector && vp)
+{
+       overall_coeff = _ex0;
+       construct_from_epvector(std::move(vp));
+       GINAC_ASSERT(is_canonical());
+}
+
 add::add(epvector && vp, const ex & oc)
 {
        overall_coeff = oc;
@@ -492,7 +499,7 @@ ex add::derivative(const symbol & y) const
        for (auto & it : seq)
                s.push_back(expair(it.rest.diff(y), it.coeff));
 
-       return dynallocate<add>(std::move(s), _ex0);
+       return dynallocate<add>(std::move(s));
 }
 
 int add::compare_same_type(const basic & other) const
index 427615769b3210bbb7d11d71b6dff41b754feb7c..aebb7c0ec2d0ba0fc7befb6e85b22b2e6242769f 100644 (file)
@@ -41,7 +41,8 @@ public:
        add(const exvector & v);
        add(const epvector & v);
        add(const epvector & v, const ex & oc);
-       add(epvector && vp, const ex & oc);
+       add(epvector && v);
+       add(epvector && v, const ex & oc);
        
        // functions overriding virtual functions from base classes
 public:
index 36960c0a8b63d5300f61ee842e5dd1280605d2d6..3f2d5cdbfc06f8cade28ce9dc8b4ade995a68caa 100644 (file)
@@ -89,6 +89,13 @@ mul::mul(const epvector & v, const ex & oc, bool do_index_renaming)
        GINAC_ASSERT(is_canonical());
 }
 
+mul::mul(epvector && vp)
+{
+       overall_coeff = _ex1;
+       construct_from_epvector(std::move(vp));
+       GINAC_ASSERT(is_canonical());
+}
+
 mul::mul(epvector && vp, const ex & oc, bool do_index_renaming)
 {
        overall_coeff = oc;
index e689ddf14a53ee346b02d3851e7cce449e0213dc..d8df65486ab49f6d7a67139b202019c3c7d5acf0 100644 (file)
@@ -42,6 +42,7 @@ public:
        mul(const exvector & v);
        mul(const epvector & v);
        mul(const epvector & v, const ex & oc, bool do_index_renaming = false);
+       mul(epvector && vp);
        mul(epvector && vp, const ex & oc, bool do_index_renaming = false);
        mul(const ex & lh, const ex & mh, const ex & rh);