Bcp 1.4.4
Loading...
Searching...
No Matches
BCP_set_intersects.hpp
Go to the documentation of this file.
1// Copyright (C) 2000, International Business Machines
2// Corporation and others. All Rights Reserved.
3#ifndef _BCP_SET_INTERSECTS_H
4#define _BCP_SET_INTERSECTS_H
5
6// This file is fully docified.
7
13template <class _InputIter1, class _InputIter2>
14const bool intersects(_InputIter1 __first1, _InputIter1 __last1,
15 _InputIter2 __first2, _InputIter2 __last2) {
16 while (__first1 != __last1 && __first2 != __last2)
17 if (*__first2 < *__first1)
18 ++__first2;
19 else if(*__first1 < *__first2)
20 ++__first1;
21 else
22 return true;
23 return false;
24}
25
33template <class _InputIter1, class _InputIter2, class _Compare>
34const bool intersects(_InputIter1 __first1, _InputIter1 __last1,
35 _InputIter2 __first2, _InputIter2 __last2,
36 _Compare __comp) {
37 while (__first1 != __last1 && __first2 != __last2)
38 if (__comp(*__first2, *__first1))
39 ++__first2;
40 else if(__comp(*__first1, *__first2))
41 ++__first1;
42 else
43 return true;
44 return false;
45}
46
47#endif
const bool intersects(_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2, _InputIter2 __last2)
Intersection tester using operator< for comparison.