2011/2/22 John Reid
I have started to use statically bounded intervals and am finding more compilation issues. For example with finding elements in a map:
#define BOOST_ICL_USE_STATIC_BOUNDED_INTERVALS #include
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.
{[0,2),[5,7)}.find([0,9))
The generalization of find is intersection. And the following function
calls compile for statically bounded right-open intervals of
continuous types:
#define BOOST_ICL_USE_STATIC_BOUNDED_INTERVALS
#include
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: http://www.boost.org/doc/libs/1_46_0/libs/icl/doc/html/boost_icl/interface/f...
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 here.
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. Cheers, Joachim -- Interval Container Library [Boost.Icl] http://www.joachim-faulhaber.de