|
Boost Users : |
Subject: [Boost-users] [icl] joining two simple intervals
From: Olaf Krzikalla (olaf.krzikalla_at_[hidden])
Date: 2013-07-22 11:37:41
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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net