2014-03-19 13:11 GMT+01:00 Oodini <svdbg___@free.fr>:
Hello,

I declared an interval_map :

interval_map<uint16_t, SomeEnumType> myMap;

Later, I do :

SomeEnumType enumValue = SOME_ENUM_VALUE;
myMap.add(std::make_pair(disxrete_interval<uint16_t>(10,17), SOME_ENUM_VALUE);

But that doesn't compile.

It seems that ICL wants the += operator must eb defined for value type (why ???).

What can I do ?

Hi,

If I remember correctly, you need to supply a combiner. The default combiner uses +=.

A combiner produces a new value for overlapping intervals. Consider (pseudocode):

myMap.add( [10,17), SOME_ENUM_VALUE );
myMap.add( [16,18), OTHER_ENUM_VALUE );

The combiner decides, what should be the value in [16,17). In this case, tries to += the OTHER_ENUM_VALUE to the existing SOME_ENUM_VALUE.

HTH,
Kris