From 86639cca6eecbdf16ed3a5428351f3bb63804cac Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Wed, 9 May 2001 23:36:16 +0000 Subject: [PATCH] - minor cleanup. --- check/exam_misc.cpp | 2 +- check/time_antipode.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/check/exam_misc.cpp b/check/exam_misc.cpp index 353afce2..17101bc5 100644 --- a/check/exam_misc.cpp +++ b/check/exam_misc.cpp @@ -139,7 +139,7 @@ static unsigned exam_operator_semantics(void) 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; diff --git a/check/time_antipode.cpp b/check/time_antipode.cpp index 2d3a13ab..12ee3db4 100644 --- a/check/time_antipode.cpp +++ b/check/time_antipode.cpp @@ -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; } + const node & operator=(const node &); ~node() { delete vert; } void add_child(const node &, bool = false); ex evaluate(const symbol &x, unsigned grad) const; @@ -172,6 +173,13 @@ private: list 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)); @@ -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. */ -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); -- 2.44.0