Boost logo

Boost Users :

Subject: [Boost-users] [ICL] interval_map::find returns only const iterator
From: CarlosRoVe (crodveg_at_[hidden])
Date: 2013-01-08 03:03:40


Hi,

I am using boost v.1.49.0 and I have a question about ICL. We are building a
system that stores information associated with time intervals. For this we
are using the interval_map container, and every element that we insert in
the map contains a right_open interval as the key, and an instance of the
structure that holds the information as the value. Some of the features of
the system are:

1. Minimum interval length is one second.
2. We have seen that the default behavior for interval_map is aggregate on
overlap, but in our case we enforce that overlapping time intervals are not
allowed. To achieve this, every time we try to insert an element we perform
a check if the time interval overlaps with any of the existing intervals in
the map, and if so, we ignore the element.
3. We should be able to modify the data associated with a time interval. We
have seen that the find method of the interval_map container returns only a
const iterator, but we would like to have a version of find that returns a
non-const iterator as well. We want to be able to search for an element
whose time interval contains a certain timestamp, and change its content.

With the given requirements, find should return one element at most. For us
it would be handy if ICL could also provide a version of find that returns a
non-const iterator, but maybe I this would break the philosophy behind the
design of ICL. We would be glad to hear ideas suggesting what we could do,
or alternatives ways of dealing with other problem.
  
Thank you very much.

--
View this message in context: http://boost.2283326.n4.nabble.com/ICL-interval-map-find-returns-only-const-iterator-tp4641095.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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