macro_rules! intersection_map_dyn { ($($val:expr),*) => { ... }; }
Expand description
Intersects one or more SortedDisjointMap iterators, creating a new SortedDisjointMap iterator.
The input iterators need not to be of the same type.
For input iterators of the same type, intersection may be slightly faster.
§Performance
All work is done on demand, in one pass through the input iterators. Minimal memory is used.
§Example: 3-Input Parity
Find the integers that appear an odd number of times in the SortedDisjointMap iterators.
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=6, 8..=9, 11..=15]);
let b = RangeSetBlaze::from_iter([5..=13, 18..=29]);
let c = RangeSetBlaze::from_iter([38..=42]);
let parity = union_map_dyn!(
intersection_map_dyn!(a.ranges(), !b.ranges(), !c.ranges()),
intersection_map_dyn!(!a.ranges(), b.ranges(), !c.ranges()),
intersection_map_dyn!(!a.ranges(), !b.ranges(), c.ranges()),
intersection_map_dyn!(a.ranges(), b.ranges(), c.ranges())
);
assert_eq!(
parity.into_string(),
"1..=4, 7..=7, 10..=10, 14..=15, 18..=29, 38..=42"
);