/home/coin/SVN-release/CoinAll-1.1.0/Bcp/src/include/BCP_set_intersects.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2000, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 #ifndef _BCP_SET_INTERSECTS_H
00004 #define _BCP_SET_INTERSECTS_H
00005 
00006 // This file is fully docified.
00007 
00013 template <class _InputIter1, class _InputIter2>
00014 const bool intersects(_InputIter1 __first1, _InputIter1 __last1,
00015                       _InputIter2 __first2, _InputIter2 __last2) {
00016    while (__first1 != __last1 && __first2 != __last2)
00017       if (*__first2 < *__first1)
00018          ++__first2;
00019       else if(*__first1 < *__first2) 
00020          ++__first1;
00021       else
00022          return true;
00023    return false;
00024 }
00025 
00033 template <class _InputIter1, class _InputIter2, class _Compare>
00034 const bool intersects(_InputIter1 __first1, _InputIter1 __last1,
00035                       _InputIter2 __first2, _InputIter2 __last2,
00036                       _Compare __comp) {
00037    while (__first1 != __last1 && __first2 != __last2)
00038       if (__comp(*__first2, *__first1))
00039          ++__first2;
00040       else if(__comp(*__first1, *__first2)) 
00041          ++__first1;
00042       else
00043          return true;
00044    return false;
00045 }
00046 
00047 #endif

Generated on Sun Nov 14 14:06:29 2010 for Coin-All by  doxygen 1.4.7