Thanks for your prompt reply ! The problem is I DO KNOW there will be never overlapping. ----- Mail original -----
De: "Krzysztof Czainski" <1czajnik@gmail.com> À: boost-users@lists.boost.org Envoyé: Mercredi 19 Mars 2014 13:18:39 Objet: Re: [Boost-users] [ICL] Can't use an enum as map value
2014-03-19 13:11 GMT+01:00 Oodini < svdbg___@free.fr > :
Hello,
I declared an interval_map :
interval_map
myMap; Later, I do :
SomeEnumType enumValue = SOME_ENUM_VALUE; myMap.add(std::make_pair(disxrete_interval
(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 _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users