gpt4 book ai didi

c++ - 如何比较 2 boost::icl::interval_set 的相等性

转载 作者:行者123 更新时间:2023-11-30 04:47:30 24 4
gpt4 key购买 nike

我想知道是否有更快的方法来判断 2 个 boost::icl::interval_set 是否相等?

我尝试了以下条件以获得更快的结果,但我猜它们并不完整:1.比较它们的大小()2.比较最低位元素3.比较最大元素

蛮力方法是在元素方面比较它们,但如果有更好的比较方法或一些内置函数,请告诉我

最佳答案

有一个有点奇怪的内置函数 is_element_equal比较两个 2 boost::icl::interval_set 的相等性。

请注意,根据 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

关于c++ - 如何比较 2 boost::icl::interval_set 的相等性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56218874/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com