Discussion:
boost::icl::contains question
(too old to reply)
Sanchay Harneja
2017-02-09 10:44:38 UTC
Permalink
Hi,

boost::icl::interval_map<int, boost::icl::interval_map<int,
boost::icl::interval_set<int>>> larger, smaller;

larger.add(make_pair(boost::icl::discrete_interval<int>::closed(102,104),
boost::icl::interval_map<int, boost::icl::interval_set<int>>{
make_pair(boost::icl::discrete_interval<int>::closed(0,0),

boost::icl::interval_set<int>{boost::icl::discrete_interval<int>::closed(2,4)})}));

smaller.add(make_pair(boost::icl::discrete_interval<int>::closed(103,103),
boost::icl::interval_map<int, boost::icl::interval_set<int>>{
make_pair(boost::icl::discrete_interval<int>::closed(0,0),

boost::icl::interval_set<int>{boost::icl::discrete_interval<int>::closed(3,3)})}));

cout << larger << endl;
cout << smaller << endl;
cout << boost::icl::contains(larger, smaller) << endl;
cout << ((smaller & larger) == smaller) << endl;

As given above, I'm trying to check if smaller is subset of larger. But I
get following output:

{([102,104]->{([0,0]->{[2,4]})})}
{([103,103]->{([0,0]->{[3,3]})})}
0
1

Any reason why boost::icl::contains(larger, smaller) doesn't work but
((smaller & larger) == smaller) works?

Thanks.

Loading...