src/Synopsis/PTree/operations.cc
[email protected] (Gilles J. Seguin)
| Newsgroups | gmane.comp.documentation.synopsis |
|---|---|
| Message-ID | <[email protected]> |
stefan, recheck this
they are not equal if both null, do they.
--- src/Synopsis/PTree/operations.cc (revision 1619)
@@ -64,10 +66,14 @@
bool equal(Node const *p, Node const *q)
{
- if(p == q) return true;
- else if(p == 0 || q == 0) return false;
+ // segg: even if both are null ?? eh eh
+ if(p == 0 || q == 0) return false;
+ else if(p == q) return true;
else if(p->is_atom() || q->is_atom()) return *p == *q;
- else return equal(p->car(), q->car()) && equal(p->cdr(), q->cdr());
+ else return equal(static_cast<const List *>(p)->car(),
+ static_cast<const List *>(q)->car())
+ && equal(static_cast<const List *>(p)->cdr(),
+ static_cast<const List *>(q)->cdr());
}
/*
have a good day
gilles
the others lines are because i have push down to subclass car(), cdr(),
position() and length() from the Node class.