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-28 14:23:14

2011/2/28 John Reid <j.reid_at_[hidden]>:
> I think this is the only part of our discussion that is still open...

right ;-)

> On 24/02/11 12:52, John Reid wrote:
>> On 24/02/11 10:48, Joachim Faulhaber wrote:
>>> Hi John,
>>> thanks again for all the questions. I am breaking up the long posting
>>> into smaller portions.
>>> (1) Representation of single elements with statically bounded intervals:
>>> 2011/2/23 John Reid<j.reid_at_[hidden]>:
>>>> On 22/02/11 20:03, Joachim Faulhaber wrote:
>>>>> 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.
>>>> Does
>>>> icl::contains( icl::interval_set< int>(), 0 );
>>>> compile, but
>>>> icl::contains( icl::interval_set< float>(), 0. );
>>>> does not for the same reason?
>>> yes.
>>> I have mentioned in the docs, that 'continuous_interval' is the only
>>> class template that allows to represent a singleton interval that
>>> contains only one element, an have provided a small example here:
>> I think the ICL needs functionality to look for elements in sets and
>> maps that have continuous domains. It seems optimistic to think the
>> users will be content without them.

Ok, lookup of elements via 'find' or check for containedness via
'contains' can be implemented without too much difficulties. For
statically bounded intervals of continuous domain types I am currently
adding a function icl::unit_closure. Unit closure is the smallest
interval for a value x that can be constructed from x using
incrementation or decrementation. For numeric domain types
unit_closure(x) always has a length of 1. For discrete domain_types
unit_closure yields the same intervals that function icl::singleton
currently computes.

Using function icl::unit_closure I am able to implement icl::find and
icl::contains and icl::intersects on element types.

I will probably commit the code and related tests to the trunk today.

Best regards,

Interval Container Library [Boost.Icl]

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