summaryrefslogtreecommitdiff
path: root/db/geo
diff options
context:
space:
mode:
authorgregs <greg@10gen.com>2011-07-08 16:32:04 -0400
committergregs <greg@10gen.com>2011-07-27 12:37:46 -0400
commit9d058fb0422a4889dba10d2cb5440edd8c59cee8 (patch)
treefc6da00c72456b1cec500584fa6fe307e8198552 /db/geo
parent4af8e70402b6b73f98178cc74e485f291a63475a (diff)
downloadmongo-9d058fb0422a4889dba10d2cb5440edd8c59cee8.tar.gz
const operators for geohashes
Diffstat (limited to 'db/geo')
-rw-r--r--db/geo/core.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/db/geo/core.h b/db/geo/core.h
index 74f4b6e8269..b77997844f2 100644
--- a/db/geo/core.h
+++ b/db/geo/core.h
@@ -278,14 +278,19 @@ namespace mongo {
return *this;
}
- bool operator==(const GeoHash& h ) {
+ bool operator==(const GeoHash& h ) const {
return _hash == h._hash && _bits == h._bits;
}
- bool operator!=(const GeoHash& h ) {
+ bool operator!=(const GeoHash& h ) const {
return !( *this == h );
}
+ bool operator<(const GeoHash& h ) const {
+ if( _hash != h._hash ) return _hash < h._hash;
+ return _bits < h._bits;
+ }
+
GeoHash& operator+=( const char * s ) {
unsigned pos = _bits * 2;
_bits += strlen(s) / 2;