|
Boost Users : |
Subject: Re: [Boost-users] [ICL] intersects(interval_set< int >, int) doesn't compile
From: Joachim Faulhaber (afojgo_at_[hidden])
Date: 2011-02-18 17:21:04
2011/2/18 John Reid <j.reid_at_[hidden]>:
> On 18/02/11 12:38, Jeff Flinn wrote:
>>
>> John Reid wrote:
>>>
>>> AFAICT from the docs the following should compile:
>>>
>>> #include <boost/icl/interval_set.hpp>
>>>
>>> namespace icl = ::boost::icl;
>>>
>>> void interval_set_intersects() {
>>> icl::intersects( icl::interval_set< int >(), 1 );
>>> }
>>>
>>>
>>>
>>> but I get a no match error:
>>>
>>> gcc.compile.c++ bin/gcc-4.4.3/debug/src/sandbox.o
>>> src/sandbox.cpp: In function void interval_set_intersects():
>>> src/sandbox.cpp:7: error: No match for
>>> intersects(boost::icl::interval_set<int, less,
>>> boost::icl::discrete_interval<int, less>, allocator> &, int)
>>
>> Just a shot, but have you noticed the first argument is by reference,
>> and you are passing a temporary? Does the following work:
>>
>> {
>> icl::interval_set<int> iclset;
>>
>> icl::intersects( iclset, 1 );
>> }
>
> Good point but it doesn't change things.
Grrr, this is an error. bool intersects(..) and bool disjoint(..) do
not compile as intended and documented for element_types and
segment_types. Thank you for spotting this. I'm going to fix that. If
you don't bother to burn up some time you can write a ticket but I
will fix this anyway. Unfortunately it's tool late for 1.46 :(
As a workaround we can fall back to using only containers as arguments
for functions intersects and disjoint:
icl::interval_set<int> iclset;
iclset += interval<int>::right_open(1,5);
icl::interval_set<int> one;
one += 1;
BOOST_CHECK(icl::intersects( iclset, one ));
BOOST_CHECK(!icl::disjoint( iclset, one ));
Regards,
Joachim
-- Interval Container Library [Boost.Icl] http://www.joachim-faulhaber.de
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