You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2008/05/27 21:13:14 UTC
svn commit: r660647 - /incubator/qpid/trunk/qpid/cpp/src/qpid/RangeSet.h
Author: aconway
Date: Tue May 27 12:13:11 2008
New Revision: 660647
URL: http://svn.apache.org/viewvc?rev=660647&view=rev
Log:
Fixed error in RangeSet, caused compile failure on Solaris.
Modified:
incubator/qpid/trunk/qpid/cpp/src/qpid/RangeSet.h
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/RangeSet.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/RangeSet.h?rev=660647&r1=660646&r2=660647&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/RangeSet.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/RangeSet.h Tue May 27 12:13:11 2008
@@ -63,6 +63,7 @@
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 @@
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>::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> 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);
}