Reputation: 170
I wanted to know if there is a faster way to know if 2 boost::icl::interval_set are equal?
I tried the following conditions for faster results but I guess they are not complete: 1.comparing their size() 2.comparing the lowest element 3.Comparing the largest element
Brute force approach is to compare both of them element wise but if there is a known better way of comparison or some in-built function,please let me know
Upvotes: 2
Views: 166
Reputation: 26800
There is the somewhat oddly named built-in function is_element_equal
to compare equality of two 2 boost::icl::interval_set
s.
Note that as per the documentation,
Equality on Sets is not implemented as operator
==
, because operator==
is used for the stronger lexicographical equality on segments, that takes the segmentation of elements into account.split_interval_set<time> w1, w2; //Pseudocode w1 = {[Mon .. Sun)}; //split_interval_set containing a week w2 = {[Mon .. Fri)[Sat .. Sun)}; //Same week split in work and week end parts. w1 == w2; //false: Different segmentation is_element_equal(w1,w2); //true: Same elements contained
Upvotes: 2