
(4) Using statically and dynamically bounded intervals in the same
compilation unit.
2011/2/23 John Reid
On a side note, I don't understand the rationale for having static bounds configured by #define whilst other aspects of intervals are parameterised using templates.
You can always instantiate ICL interval container templates with the interval type of your choice via the template parameter IntervalT. See e.g. http://www.boost.org/doc/libs/1_46_0/libs/icl/doc/html/boost_icl/interface.h... #define BOOST_ICL_USE_STATIC_BOUNDED_INTERVALS switches the default value for this template-parameter from dynamically bounded to statically bounded intervals. Like any other default of a template parameter you can change it via instantiation. The rational behind this is (1) the intention, to minimize the effort for users, that have applications of ITL containers and want to change their code using statically bounded intervals now. In the ITL every interval was dynamically bounded. (2) for applications that only use one kind of intervals, e.g. statically bounded ones, #define BOOST_ICL_USE_STATIC_BOUNDED_INTERVALS can be convenient, because you need only to specify the first one or two template parameter for interval containers most of the time.
I would have liked to have both types of interval in the same compilation unit. NP
However I guess it must be too late to change this fundamental design choice.
Fortunately it's not too late ;-)
This code shows how to use icl sets with variations of interval types.
BOOST_AUTO_TEST_CASE(using_vaious_interval_types)
{
interval_set
dyn_float_set;
dyn_int_set += discrete_interval<int>(1); BOOST_CHECK(( contains(dyn_int_set,1) )); stat_int_set += right_open_interval<int>(1); BOOST_CHECK(( contains(stat_int_set,1) )); dyn_float_set += continuous_interval<float>(1.0); BOOST_CHECK(( contains(dyn_float_set, 1.0) )); } For interval_map this can get a little verbose, because of the greater number of template parameters. Thank you for your questions. They help to clarify a lot of issues around the library (even for the author:) Joachim -- Interval Container Library [Boost.Icl] http://www.joachim-faulhaber.de