]> www.ginac.de Git - ginac.git/commitdiff
- minor cleanup.
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Wed, 9 May 2001 23:36:16 +0000 (23:36 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Wed, 9 May 2001 23:36:16 +0000 (23:36 +0000)
check/exam_misc.cpp
check/time_antipode.cpp

index 353afce2a0840fcf84a3cac240020b9948d9a776..17101bc5fcb2370983be434283e7f3706b4a5d9e 100644 (file)
@@ -139,7 +139,7 @@ static unsigned exam_operator_semantics(void)
        ex e1, e2;
        int i1, i2;
        
        ex e1, e2;
        int i1, i2;
        
-       // Assignment should not return const ex:
+       // Assignment should not return const ex though it may be obfuscated:
        e1 = 7; e2 = 4;
        i1 = 7; i2 = 4;
        (e1 = e2) = 2;
        e1 = 7; e2 = 4;
        i1 = 7; i2 = 4;
        (e1 = e2) = 2;
index 2d3a13ab706d594228b1a2a792f18d5ac630c806..12ee3db417fe1489d0e40748f528393fd82ba2a6 100644 (file)
@@ -163,6 +163,7 @@ class node {
 public:
        node(const vertex &v) { vert = v.copy(); }
        node(const node &n) { vert = (n.vert)->copy(); children = n.children; }
 public:
        node(const vertex &v) { vert = v.copy(); }
        node(const node &n) { vert = (n.vert)->copy(); children = n.children; }
+       const node & operator=(const node &);
        ~node() { delete vert; }
        void add_child(const node &, bool = false);
        ex evaluate(const symbol &x, unsigned grad) const;
        ~node() { delete vert; }
        void add_child(const node &, bool = false);
        ex evaluate(const symbol &x, unsigned grad) const;
@@ -172,6 +173,13 @@ private:
        list<child> children;
 };
 
        list<child> children;
 };
 
+const node & node::operator=(const node &n)
+{
+       delete vert;
+       vert = (n.vert)->copy();
+       children = n.children;
+}
+
 void node::add_child(const node &childnode, bool cut)
 {
        children.push_back(child(childnode, cut));
 void node::add_child(const node &childnode, bool cut)
 {
        children.push_back(child(childnode, cut));
@@ -209,7 +217,7 @@ unsigned node::total_edges(void) const
  * written using calls to node's method add_child() because it allows for
  * editor-assisted indentation.
  */
  * written using calls to node's method add_child() because it allows for
  * editor-assisted indentation.
  */
-node operator+(const node &n, const child &c)
+const node operator+(const node &n, const child &c)
 {
        node nn(n);
        nn.add_child(c.first, c.second);
 {
        node nn(n);
        nn.add_child(c.first, c.second);