Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6095: boost::icl::is_empty fails for certain open intervals
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-11-07 08:21:30
#6095: boost::icl::is_empty fails for certain open intervals
----------------------------------------------------------------+-----------
Reporter: Marvin Sielenkemper <m.sielenkemper@â¦> | Owner: jofaber
Type: Bugs | Status: new
Milestone: To Be Determined | Component: ICL
Version: Boost 1.47.0 | Severity: Problem
Resolution: | Keywords:
----------------------------------------------------------------+-----------
Comment (by Marvin Sielenkemper <m.sielenkemper@â¦>):
Hi Joachim,
as a mathematician I have to disagree: what distinguishes the interval
{{{Interval::open(max, max)}}} from {{{Interval::open(0, 0)}}}? For both
there exist no elements, that is the point of being empty. Even intervals
like {{{Interval::closed(17, 4)}}} are allowed and deemed empty!
As a programmer I might be able to accept the responsibility to avoid such
cases, but only if I were able to do so. I encountered the problem not
while putting open intervals into the container but closed ones. And for
those borders like {{{min}}} and {{{max}}} certainly make sense.
What I was trying to do was
{{{
BOOST_AUTO_TEST_CASE(totalRangeTest)
{
typedef int
Value;
typedef boost::icl::interval<Value>
Interval;
typedef std::numeric_limits<Value>
Limits;
typedef boost::icl::interval_map<Value, int,
boost::icl::total_enricher> Container;
Value const min(Limits::min());
Value const max(Limits::max());
boost::icl::interval_map<Value, int, boost::icl::total_enricher>
intervals;
intervals += std::make_pair(Interval::closed(min, max), 0);
intervals += std::make_pair(Interval::right_open(0, 10), 3);
BOOST_CHECK_EQUAL(intervals.iterative_size(), 3);
}
}}}
and this fails {{{BOOST_ASSERT(this->_map.find(inter_val) ==
this->_map.end());}}} in {{{interval_base_map.hpp}}}, line 530 while
trying to calculate the new third element of the container
({{{Interval::closed(10, max)}}}) when inserting the second interval.
Drilling down on that, I found {{{is_empty}}} and its problematic
behaviour.
Thank you for your response!
Best regards,[[br]]
Marvin
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6095#comment:2> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC