21template <
class T,
class U>
29template <
class T,
class U>
33 if (
rep->item->contains (x))
return rep->item (x);
39template <
class T,
class U>
42 if (item->contains (x))
return true;
43 if (
is_nil (next))
return false;
44 return next->contains (x);
47template <
class T,
class U>
54template <
class T,
class U>
57 ASSERT (!
is_nil (next),
"relative hashmap cannot be shortened");
62template <
class T,
class U>
65 ASSERT (!
is_nil (next),
"relative hashmap cannot be merged");
70template <
class T,
class U>
76 for (i= 0; i <
CH->n; i++) {
79 if (h[l->item.key] == l->item.im)
90template <
class T,
class U>
95 for (i= 0; i < item->n; i++) {
98 if (!
CH->contains (l->item.key))
104 CH (
add->item.key)= next[
add->item.key];
110template <
class T,
class U>
114 for (i= 0; i <
CH->n; i++) {
117 item (l->item.key)= l->item.im;
123template <
class T,
class U>
126 if (
is_nil (
H)) out <<
"(null)";
129 out <<
H->item <<
LF;
133 out <<
H->item <<
LF;
#define ASSERT(cond, msg)
Macro used to assert that a condition is true, and throw an exception with an error message if the co...
The list class represents a linked list.
list(T item)
Construct a new list object with a single item.
void find_changes(hashmap< T, U > &CH)
void change(hashmap< T, U > CH)
void find_differences(hashmap< T, U > &CH)
list< T > remove(list< T > l, T what)
Create a new list with a specific item removed.
bool is_nil(list< T > l)
Check if a list is nil (i.e., an empty list).
list< T > copy(list< T > l)
Create a copy of a list.
tm_ostream & operator<<(tm_ostream &out, rel_hashmap< T, U > H)