Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-12-04 20:56:34


Great! Go ahead and add this to the wiki. (feel free to just cut and paste
this email)

Cheers,
Jeremy

On Tue, 4 Dec 2001, Joe Gottman wrote:

> One algorithm that I have found useful is sets_intersect(). It takes two
> sorted ranges and return a boolean saying whether they have any elements in
> common.
>
>
> template <typename Iterator1, typename Iterator2>
> bool sets_intersect(Iterator1 start1, Iterator1 end1, Iterator2 start2,
> Iterator2 end2)
> {
> while ((start1 != end1) && (start2 != end2)) {
> if (*start1 < *start2) {
> ++start1;
> } else if (*start2 < *start1) {
> ++start2;
> } else {
> return true;
> }
> }
> return false;
> }
>
>
> There is a similar function that takes a predicate as a third template
> parameter. You could use std::set_intersection() to determine if two ranges
> intersect, but this function has two advantages. You do not have to
> allocate space for the output set, and this function returns true as soon as
> the first point of intersection is found. The one thing I'm not sure about
> is the name. It's very close to std::set_intersection(), but I can't think
> of a better one off the top of my head.
>
> Joe Gottman
>
>
>
>
> ----- Original Message -----
> From: "Jeremy Siek" <jsiek_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Tuesday, December 04, 2001 4:53 PM
> Subject: [boost] Boost.Algorithm library
>
>
> > Hi All,
> >
> > Every so often the topic comes up of miscellaneous algorithms that aren't
> > in STL, and would be good to have in Boost. I had volunteered to get that
> > started, but haven't had much time to do so, and didn't have a good idea
> > of how to get started.
> >
> > So, to finally get things started, I've created a page at the Boost Users
> > Wiki.
> >
> >
> http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?STLAlgorithmE
> xtensions
> >
>
>
>
> Info: http://www.boost.org Send unsubscribe requests to: <mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>

----------------------------------------------------------------------
 Jeremy Siek http://www.osl.iu.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk