Boost logo

Boost :

Subject: Re: [boost] [Boost-users] [boost-users][ICL] ICL Compilation errors. Ticket #5207
From: Joachim Faulhaber (afojgo_at_[hidden])
Date: 2011-02-22 15:03:29

2011/2/22 John Reid <j.reid_at_[hidden]>
> I have started to use statically bounded intervals
> and am finding more compilation issues. For example
> with finding elements in a map:
> #include <boost/icl/interval_map.hpp>
> void f() {
>        namespace icl = ::boost::icl;
>        icl::interval_map< float, int >().find( 0 );
> }
> This compiles without the #define but fails on static intervals.

This is on purpose. The reason is that we can not represent a single
element x using a right-open interval [x,?) of continuous values.
right_open_interval is the default for statically bounded intervals,
if BOOST_ICL_USE_STATIC_BOUNDED_INTERVALS is defined. In order to use
find on an interval_map we have to construct an interval that
represents a single element (internally). This is not possible in the
logic of the ICL so this code won't compile.

interval_map::find is a pretty late addition to ITL/ICL, because using
find in the STL way makes little sense on interval containers most of
the time. We can not "find" an large interval in an icl::interval_set
of small intervals.


The generalization of find is intersection. And the following function
calls compile for statically bounded right-open intervals of
continuous types:

#include <boost/icl/interval_map.hpp>
  icl::interval_map< float, int> iclmap;
  icl::interval_map< float, int> found;
  add_intersection(found, iclmap,
  add_intersection(found, icl::interval_map< float, int>(),
  found = iclmap & right_open_interval<float>(0,1);
  found = icl::interval_map< float, int>()
             & right_open_interval<float>(0,1);

> This makes me think it might be worth having tests for
> every possible combination that is listed in the function
> synopsis for both static and for dynamic intervals:

I am working on it. But as you see from this example, not every
function overload works for dynamically bounded and statically bounded
intervals in the same way. I think the documentation can be improved

> I can keep you up-to-date with any further problems I find

please do.

> but I'm just wondering whether it would be easier to fix them all in one go.

Currently it's no problem for me to fix them as they are detected.


Interval Container Library [Boost.Icl]

Boost list run by bdawes at, gregod at, cpdaniel at, john at