/*
- * $Id: splay.h,v 1.23 2003/09/02 21:45:48 robertc Exp $
+ * $Id: splay.h,v 1.24 2003/09/02 22:57:00 robertc Exp $
*/
#ifndef SQUID_SPLAY_H
typedef void SPLAYWALKEE(Value const & nodedata, void *state);
static void DefaultFree (Value &aValue) {delete aValue;}
- SplayNode<V> ();
+ SplayNode<V> (Value const &);
Value data;
mutable SplayNode<V> *left;
mutable SplayNode<V> *right;
/* inline methods */
template<class V>
-SplayNode<V>::SplayNode () : data(NULL), left(NULL), right (NULL) {}
+SplayNode<V>::SplayNode (Value const &someData) : data(someData), left(NULL), right (NULL) {}
+
template<class V>
void
SplayNode<V>::walk(SPLAYWALKEE * walkee, void *state)
SplayNode<V>::insert(Value dataToInsert, SPLAYCMP * compare)
{
/* create node to insert */
- SplayNode<V> *newNode = new SplayNode<V>;
- newNode->data = dataToInsert;
+ SplayNode<V> *newNode = new SplayNode<V>(dataToInsert);
if (this == NULL) {
splayLastResult = -1;
return NULL;
}
- SplayNode<V> N;
+ SplayNode<V> N(dataToFind);
SplayNode<V> *l;
SplayNode<V> *r;
SplayNode<V> *y;