boost - interval map in C++ -


i need map intervals (actually these intervals of addresses) object ids.

i tried use boost's interval_map, example looks pretty, enumerates intervals like:

while(it != party.end()) {     interval<ptime>::type when = it->first;     // @ party within time interval 'when' ?     guestsett = (*it++).second;     cout << when << ": " << << endl; } 

which outputs:

     ----- history of party guests -------------------------     [2008-may-20 19:30:00, 2008-may-20 20:10:00): harry mary     [2008-may-20 20:10:00, 2008-may-20 22:15:00): diana harry mary susan     [2008-may-20 22:15:00, 2008-may-20 23:00:00): diana harry mary peter susan     [2008-may-20 23:00:00, 2008-may-21 00:00:00): diana peter susan     [2008-may-21 00:00:00, 2008-may-21 00:30:00): peter 

but cannot this:

interval<ptime>::type when =      interval<ptime>::closed(         time_from_string("2008-05-20 22:00"),         time_from_string("2008-05-20 22:01"));      guestsett = party[when];      cout << when << ": " << << endl; 

it outputs: error: no match 'operator[]' in 'party[when]' looks strange, since main function of map in operator[]

so cannot information "who @ party @ given time"

is there ready-to-use solution problem?

it's counter-intuitive, () operator you're looking for. docs, operator() defined "return[ing] mapped value key x. operator available total maps."

source: http://www.boost.org/doc/libs/1_54_0/libs/icl/doc/html/boost_icl/function_reference/selection.html


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -