|
Boost Users : |
Subject: Re: [Boost-users] [ICL] Can't use an enum as map value
From: Oodini (svdbg____at_[hidden])
Date: 2014-03-19 08:41:03
Thanks for your prompt reply !
The problem is I DO KNOW there will be never overlapping.
----- Mail original -----
> De: "Krzysztof Czainski" <1czajnik_at_[hidden]>
> Ã: boost-users_at_[hidden]
> 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____at_[hidden] > :
>
>
>
>
> 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
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net