10 template<class K
, class V
>
18 /** mindblowingly stupid Associative array implementation.
21 template<class K
, class V
>
23 Array
< Assoc_ent_
<K
,V
> > arr
;
27 int find(K key
) const {
28 for (int i
= 0; i
< arr
.size(); i
++) {
29 if (!arr
[i
].free
&& key
== arr
[i
].key
)
34 int find_creat(K key
) {
36 for (int i
= 0; i
< arr
.size(); i
++) {
37 if (key
== arr
[i
].key
) {
39 } else if (arr
[i
].free
) {
44 arr
[free
].free
= false;
56 bool elt_query(K key
) const {
57 return find(key
) >= 0;
60 assert(elt_query(key
));
66 int i
= find_creat(key
);
69 V
& operator[](K key
) {
70 return arr
[find_creat(key
)].val
;
72 const V
& operator[](K key
) const {
73 assert(elt_query(key
));
74 return arr
[find(key
)].val
;