c++ - An integer hashing problem -
i have (c++) std::map<int, myobject*> contains couple of millions of objects of type myobject*. maximum number of objects can have, around 100 millions. key object's id. during process, these objects must somehow marked( 0 or 1) fast possible. marking cannot happen on objects (so cannot introduce member variable , use marking process). since know minimum , maximum id (1 100_000_000), first thought occured me, use std::bit_set<100000000> , perform marking there. solves problem , makes easier when marking processes run in parallel, since these use own bit_set mark things, wondering solution be, if had use else instead of 0-1 marking, e.g use if had mark objects integer number ?
is there form of data structure can deal kind of problem in compact (memory-wise) manner, , fast ? main queries of interest whether object marked, , marked with.
thank you.
note: std::map<int, myobject*> cannot changed. whatever data structure use, must not deal map itself.
how making value_type of map std::pair<bool, myobject*> instead of myobject*?
Comments
Post a Comment