diff options
author | Alan Conway <aconway@apache.org> | 2008-05-27 19:13:11 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2008-05-27 19:13:11 +0000 |
commit | 484dd3d384035e5d39a4e5c17fc0a955b82b9d91 (patch) | |
tree | 2456317799883ec200e0aa0b8cc852c0df192acc /cpp/src | |
parent | 63f68e2f68cafce3da7ca03113e6eddc38d405b3 (diff) | |
download | qpid-python-484dd3d384035e5d39a4e5c17fc0a955b82b9d91.tar.gz |
Fixed error in RangeSet, caused compile failure on Solaris.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@660647 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/RangeSet.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cpp/src/qpid/RangeSet.h b/cpp/src/qpid/RangeSet.h index a8849cf9b8..af3b2223cd 100644 --- a/cpp/src/qpid/RangeSet.h +++ b/cpp/src/qpid/RangeSet.h @@ -63,6 +63,7 @@ class Range { bool operator==(const Range& x) { return begin_ == x.begin_ && end_== x.end_; } bool operator<(const T& t) const { return end_ < t; } + bool operator<(const Range<T>& r) const { return end_ < r.begin_; } /** touching ranges can be merged into a single range. */ bool touching(const Range& r) const { @@ -204,21 +205,21 @@ std::ostream& operator<<(std::ostream& o, const RangeSet<T>& rs) { template <class T> bool RangeSet<T>::contains(const T& t) const { typename Ranges::const_iterator i = - std::lower_bound(ranges.begin(), ranges.end(), t); + std::lower_bound(ranges.begin(), ranges.end(), Range<T>(t)); return i != ranges.end() && i->contains(t); } template <class T> bool RangeSet<T>::contains(const Range<T>& r) const { typename Ranges::const_iterator i = - std::lower_bound(ranges.begin(), ranges.end(), r.begin()); + std::lower_bound(ranges.begin(), ranges.end(), r); return i != ranges.end() && i->contains(r); } template <class T> void RangeSet<T>::addRange(const Range<T>& r) { if (r.empty()) return; typename Ranges::iterator i = - std::lower_bound(ranges.begin(), ranges.end(), r.begin()); + std::lower_bound(ranges.begin(), ranges.end(), r); if (i == ranges.end() || !i->touching(r)) ranges.insert(i, r); else { @@ -241,7 +242,7 @@ template <class T> void RangeSet<T>::addSet(const RangeSet<T>& s) { template <class T> void RangeSet<T>::removeRange(const Range<T>& r) { if (r.empty()) return; typename Ranges::iterator i,j; - i = std::lower_bound(ranges.begin(), ranges.end(), r.begin()); + i = std::lower_bound(ranges.begin(), ranges.end(), r); if (i == ranges.end() || i->begin() >= r.end()) return; // Outside of set if (*i == r) // Erase i @@ -304,7 +305,7 @@ template <class T> bool RangeSet<T>::iterator::equal(const iterator& i) const { template <class T> Range<T> RangeSet<T>::rangeContaining(const T& t) const { typename Ranges::const_iterator i = - std::lower_bound(ranges.begin(), ranges.end(), t); + std::lower_bound(ranges.begin(), ranges.end(), Range<T>(t)); return (i != ranges.end() && i->contains(t)) ? *i : Range<T>(t,t); } |