Boost logo

Boost Users :

Subject: Re: [Boost-users] Using Boost ICL for range matching
From: Rajalakshmi Iyer (raj_at_[hidden])
Date: 2012-06-21 07:33:22


Thanks Joachim,

A follow-up question. What would be performance of this lookup on an
interval_set? I am assuming it definitely performs much better that
iterating over each interval in the set to find the range match.

Regards,
Raj

On Thu, Jun 21, 2012 at 8:17 AM, Joachim Faulhaber <afojgo_at_[hidden]>wrote:

>
>
> 2012/6/18 Rajalakshmi Iyer <raj_at_[hidden]>
>
>> Hello,
>>
>> I want to know if I can use the boost::icl::interval_set to store a set
>> of integer based intervals like:
>> [100, 200], [50, 600] etc
>>
>> and then find out whether a number like 150 matches any of these
>> intervals?
>>
>
> An icl::interval_set does not store the individual intervals that are
> inserted into it, if they overlap. Basically the interval set is just a set
> that stores contiguous chunks of elements in a compact way as intervals. So
> ...
>
> #include <boost/icl/interval_set.hpp>
> #include <boost/icl/interval.hpp>
> using namespace std;
> using namespace boost::icl;
>
> interval_set<int> aSet; //aSet={}
> aSet += interval<int>::closed(100,200); //aSet={[100,200]}
> aSet += interval<int>::closed( 50,600); //aSet={[ 50,600]}
> cout << "aSet " <<
> (contains(aSet, 150) ? "contains 150\n"
> : "does not contain 150\n");
>
> The example you ask for will look like this.
>
> HTH,
> Joachim
>
>
> --
> Interval Container Library [Boost.Icl]
> http://www.joachim-faulhaber.de
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
*Twitter: @Blismedia <http://twitter.com/#%21/blismobile>
BlisMedia 
32 Percy Street,
London W1T 2DE
www.blismedia.com <http://www.blismobile.com/>**
*** <http://www.blismobile.com/>*
****[image: Follow on Twitter]* <http://twitter.com/#%21/blismobile>*[image: 
Blis Website]* <http://www.blismobile.com/>
*This communication is from Blis Media Ltd, a company registered in England 
and Wales with registered number 06455773. Its registered office is 32 
Percy Street, London W1T 2DE, United Kingdom.*
* *
*This communication contains information that is confidential and may also 
be privileged. It is for the exclusive use of the intended recipient(s). If 
you are not the intended recipient(s), please (1) notify info_at_[hidden]<info_at_[hidden]> by 
forwarding this email and delete all copies from your system and (2) note 
that disclosure, distribution, copying or use of this communication is 
strictly prohibited. Email communications cannot be guaranteed to be secure 
or free from error or viruses. All emails sent to or from a Blismobile 
email account are securely archived and stored by an external supplier. This 
email does not constitute a contractual agreement; such agreements are in 
specified contractual or Insertion Order (IO) form only 
and exclusively contain all the terms to which Blis Mobile Ltd will be 
bound. To the extent permitted by law, Blis Mobile Ltd does not accept any 
liability for use of or reliance on the contents of this email by any 
person save by the intended recipient(s) to the extent agreed in a contract 
or Insertion Order.*
* *
*Opinions, conclusions and other information in this email which have not 
been delivered by way of the business of Breeze Tech (UK) Ltd are neither 
given nor endorsed by it.*


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