[icl] joining two simple intervals
Hi, I just tried and failed to find a simple way to compute the upper and lower bounds of some interval_sets: typedef boost::icl::interval_set<int> list_type; typedef list_type::value_type interval; void add_region(interval& av, const list_type& reg) { av += reg; // didn't work if (!reg.empty()) { // didn't work either: av += tAddressInterval( reg.begin()->lower(), (--reg.end())->upper())); // this one works: av = tAddressInterval(std::min(av.lower(), reg.begin()->lower()), std::max(av.lower(), (--reg.end())->upper())); } } My workaround doesn't even respect the boundary types. I wonder if there is not a simpler way for such a fundamental tasks. Best regards Olaf
On 7/22/2013 11:37 AM, Olaf Krzikalla wrote:
Hi,
I just tried and failed to find a simple way to compute the upper and lower bounds of some interval_sets:
typedef boost::icl::interval_set<int> list_type; typedef list_type::value_type interval;
void add_region(interval& av, const list_type& reg) { av += reg; // didn't work if (!reg.empty()) { // didn't work either: av += tAddressInterval( reg.begin()->lower(), (--reg.end())->upper()));
// this one works: av = tAddressInterval(std::min(av.lower(), reg.begin()->lower()), std::max(av.lower(), (--reg.end())->upper())); } }
My workaround doesn't even respect the boundary types. I wonder if there is not a simpler way for such a fundamental tasks.
Is this what you want?: av = hull( hull(reg), av); per http://www.boost.org/doc/libs/1_52_0/libs/icl/doc/html/boost_icl/function_re... Jeff
Am 22.07.2013 18:53, schrieb Jeff Flinn:
Is this what you want?:
av = hull( hull(reg), av);
per http://www.boost.org/doc/libs/1_52_0/libs/icl/doc/html/boost_icl/function_re... Indeed. Thank you. Haven't found that, since I did overlook the range chapter.
Best Olaf
participants (2)
-
Jeff Flinn
-
Olaf Krzikalla