I have a curious problem and I am brainstorming possible solutions. The problem is such: I have a number of inputs (up to several thousand different ones), whic开发者_C百科h basically differ in two-three arrays (arrays are a different size generaly, from size one up to couple thousand elements long). the functions which process arrays take some time to initialize data, so i thought to cache function/functor together with data and store them in map.
now, how do i go about converting raw arrays into usable hashtable type? i initially thought to read array into a string and use string as the key. is it good idea? do you have better suggestion?
Are these arrays integer? If yes, just go with something like this
hash = (hash + (324723947 + a[i])) ^93485734985;
Similar thing would work fine for strings if you do it on all characters. Finally, you may check out extra libs here
精彩评论