6 template<class K
,class V
>
13 template<class K
, class V
>
15 svec
< Assoc_ent_
<K
,V
> > arr
;
19 int find(K key
) const {
20 for (int i
= 0; i
< arr
.sz(); i
++) {
21 if (!arr
[i
].free
&& key
== arr
[i
].key
)
26 int find_creat(K key
) {
28 for (int i
= 0; i
< arr
.sz(); i
++) {
29 if (key
== arr
[i
].key
) {
31 } else if (arr
[i
].free
) {
36 arr
[free
].free
= false;
48 bool elt_query(K key
) const {
49 return find(key
) >= 0;
52 assert(elt_query(key
));
58 int i
= find_creat(key
);
62 should create "set" template
64 V
& operator[](K key
) {
65 return arr
[find_creat(key
)].val
;
67 const V
& operator[](K key
) const {
68 assert(elt_query(key
));
69 return arr
[find(key
)].val
;
73 /** mindblowingly stupid Associative array implementation