|
Boost Users : |
Subject: Re: [Boost-users] [icl] joining two simple intervals
From: Jeff Flinn (Jeffrey.Flinn_at_[hidden])
Date: 2013-07-22 12:53:29
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_reference/range.html
Jeff
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