Lolly 1.4.27
Loading...
Searching...
No Matches
Macros | Functions
hashmap.ipp File Reference
#include "hashmap.hpp"
Include dependency graph for hashmap.ipp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HASHMAP_CC
 
#define TMPL   template <class T, class U>
 
#define H   hashentry<T, U>
 

Functions

template<class T , class U >
tm_ostreamoperator<< (tm_ostream &out, H h)
 
template<class T , class U >
bool operator== (H h1, H h2)
 
template<class T , class U >
bool operator!= (H h1, H h2)
 
template<class T , class U >
tm_ostreamoperator<< (tm_ostream &out, hashmap< T, U > h)
 
template<class T , class U >
bool operator== (hashmap< T, U > h1, hashmap< T, U > h2)
 
template<class T , class U >
bool operator!= (hashmap< T, U > h1, hashmap< T, U > h2)
 

Macro Definition Documentation

◆ HASHMAP_CC

#define HASHMAP_CC

Definition at line 13 of file hashmap.ipp.

◆ TMPL

#define TMPL   template <class T, class U>

Definition at line 16 of file hashmap.ipp.

◆ H

#define H   hashentry<T, U>

Definition at line 17 of file hashmap.ipp.

Function Documentation

◆ operator<<() [1/2]

template<class T , class U >
tm_ostream & operator<< ( tm_ostream & out,
H h )

Definition at line 27 of file hashmap.ipp.

28 {
29 out << h.key << "->" << h.im;
30 return out;
31}

◆ operator==() [1/2]

template<class T , class U >
bool operator== ( H h1,
H h2 )

Definition at line 34 of file hashmap.ipp.

34 {
35 return (h1.code == h2.code) && (h1.key == h2.key) && (h1.im == h2.im);
36}
The list class represents a linked list.
Definition list.hpp:48

◆ operator!=() [1/2]

template<class T , class U >
bool operator!= ( H h1,
H h2 )

Definition at line 39 of file hashmap.ipp.

39 {
40 return (h1.code != h2.code) || (h1.key != h2.key) || (h1.im != h2.im);
41}

◆ operator<<() [2/2]

template<class T , class U >
tm_ostream & operator<< ( tm_ostream & out,
hashmap< T, U > h )

Definition at line 134 of file hashmap.ipp.

135 {
136 int i= 0, j= 0, n= h->n, size= h->size;
137 out << "{ ";
138 for (; i < n; i++) {
139 list<hashentry<T, U>> l= h->a[i];
140 for (; !is_nil (l); l= l->next, j++) {
141 out << l->item;
142 if (j != size - 1) out << ", ";
143 }
144 }
145 out << " }";
146 return out;
147}
bool is_nil(blackbox x)
Definition blackbox.hpp:29

◆ operator==() [2/2]

template<class T , class U >
bool operator== ( hashmap< T, U > h1,
hashmap< T, U > h2 )

Definition at line 160 of file hashmap.ipp.

160 {
161 if (h1->size != h2->size) return false;
162 int i= 0, n= h1->n;
163 for (; i < n; i++) {
164 list<hashentry<T, U>> l= h1->a[i];
165 for (; !is_nil (l); l= l->next)
166 if (h2[l->item.key] != l->item.im) return false;
167 }
168 return true;
169}

◆ operator!=() [2/2]

template<class T , class U >
bool operator!= ( hashmap< T, U > h1,
hashmap< T, U > h2 )

Definition at line 172 of file hashmap.ipp.

172 {
173 return !(h1 == h2);
174}