Boost logo

Boost Users :

Subject: [Boost-users] [ICL] Specific interval_map
From: A G (heyji2_at_[hidden])
Date: 2012-09-27 11:55:33


Hello,

I am trying to see whether I can use interval_map for my project. I was
initially amazed with interval_map and thought this would be it, but then I
have some doubts:

I need a interval tree like interval_map, but the aggregated values have
the following equivalent property: equal to the length of the interval it
is aggregated with. An example:

[0:3] -> 3
[4:8] -> 4

Then if I add the interval [2:5] with aggregated value 3 (step 1) to this
container, this should end up with:

[0:1] -> 1
[2:3] -> 1
[4:5] -> 1
[6:8] -> 2

which I would later need to change into (step 2) :

[0:1] -> 1
[2:5] -> 3 ([2:3] and [4:5] are merged because what matter is the last
inserted interval: [2:3]).
[6:8] -> 2

I am not sure I can do step 1 in just overloading the operator+= over my
aggregated values. Could you please confirm ? If so, is there any part of
the library I can reuse to do this task (like a function overloading, but
which one) or do I have to rewrite an ad-hoc insert-like method myself ?

Thank you for your hints.

BR,

AG.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net