Open justinasvd opened 6 months ago
N.B. the behavior of
tst.erase(std::make_pair(test_range, foo{}));
is even more baffling, as it is a no-op!
Hi Justinas,
subtracting an interval
from an Interval_map
using the -=
operator is effectively erasing the all content form the interval_map
within the interval test_range
.
If you'd like intersection
to be propagated to values of the map, you need to combine two interval_maps
that must have the same codomain
type being a model of concept Set
.
You may take a look at example user groups for this kind of operations.
Best regards,
Joachim
Consider a test program
The output of this program is going to be
This behavior is very surprising, because I would have expected that an
inter_sect
(in our casedummy_
) f-tor would be used for the intersecting ranges [2,4) and [6,8). In my own use case, the correct output after removal should beafter remove: {([0,2)->0)([2,3)->
0)([7,8)->
0)([8,10)->80)}
But I see no way to achieve this with the current implementation of
erase(interval)
.