10 template<class K, class V>
18 /** mindblowingly stupid Associative array implementation.
21 TODO: a decent hash for strings.
23 template<class K, class V>
25 Array< Assoc_ent_<K,V> > arr;
29 int find (K key) const {
30 for (int i = 0; i < arr.size(); i++) {
31 if (!arr[i].free && key == arr[i].key)
36 int find_creat (K key) {
38 for (int i = 0; i < arr.size(); i++) {
39 if (!arr[i].free && key == arr[i].key) {
41 } else if (arr[i].free) {
46 arr[free].free = false;
58 bool elt_b (K key) const {
59 return find (key) >= 0;
66 void add (K key, V val) {
67 int i = find_creat (key);
71 return arr[find_creat (key)].val;
73 V& operator[](K key) {
76 V const & operator[](K key) const {
79 V const & elem (K key) const {
81 return arr[find (key)].val;
85 for (int i=0 ; i < arr.size (); i++)