Added documentation to Splay::find
Added Splay::empty()
Removed obsolete tests in test-suite/splay.cc
+
+// private class of Splay. Do not use directly
template <class V>
class SplayNode
{
template <class V>
class SplayNode
{
Value data;
mutable SplayNode<V> *left;
mutable SplayNode<V> *right;
Value data;
mutable SplayNode<V> *left;
mutable SplayNode<V> *right;
- void destroy(SPLAYFREE *);
+ void destroy(SPLAYFREE * = DefaultFree);
void walk(SPLAYWALKEE *, void *callerState);
bool empty() const { return this == NULL; }
SplayNode<V> const * start() const;
void walk(SPLAYWALKEE *, void *callerState);
bool empty() const { return this == NULL; }
SplayNode<V> const * start() const;
SplayNode<V> * insert(Value data, SPLAYCMP * compare);
SplayNode<V> * insert(Value data, SPLAYCMP * compare);
+ /// look in the splay for data for where compare(data,candidate) == true.
+ /// return NULL if not found, a pointer to the sought data if found.
template <class FindValue> SplayNode<V> * splay(const FindValue &data, int( * compare)(FindValue const &a, Value const &b)) const;
/// recursively visit left nodes, this node, and then right nodes
template <class FindValue> SplayNode<V> * splay(const FindValue &data, int( * compare)(FindValue const &a, Value const &b)) const;
/// recursively visit left nodes, this node, and then right nodes
mutable SplayNode<V> * head;
template <class FindValue> Value const *find (FindValue const &, int( * compare)(FindValue const &a, Value const &b)) const;
mutable SplayNode<V> * head;
template <class FindValue> Value const *find (FindValue const &, int( * compare)(FindValue const &a, Value const &b)) const;
void insert(Value const &, SPLAYCMP *compare);
void remove(Value const &, SPLAYCMP *compare);
void insert(Value const &, SPLAYCMP *compare);
void remove(Value const &, SPLAYCMP *compare);
- void destroy(SPLAYFREE *);
+ void destroy(SPLAYFREE * = SplayNode<V>::DefaultFree);
SplayNode<V> const * start() const;
SplayNode<V> const * start() const;
+ bool empty() { return size() == 0; }
+
const_iterator begin() const;
const_iterator end() const;
const_iterator begin() const;
const_iterator end() const;
safeTop->walk(SplayCheck::WalkNodeRef, NULL);
safeTop->destroy(destintref);
safeTop->walk(SplayCheck::WalkNodeRef, NULL);
safeTop->destroy(destintref);
- /* check we don't segfault on NULL splay calls */
- safeTop = NULL;
- safeTop->splay(intnode(), compareintref);
- SplayCheck::BeginWalk();
- safeTop->walk(SplayCheck::WalkNodeRef, NULL);
}
/* check the check routine */
}
/* check the check routine */