summaryrefslogtreecommitdiff
path: root/src/mongo/bson/bsonelement.h
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2015-01-14 13:43:32 -0500
committerMathias Stearn <mathias@10gen.com>2015-01-15 18:08:36 -0500
commitaa3247ba48f78f4423874f2a64f00b12bf0b27d6 (patch)
treeb0de7870ef02b4f6d85c23b9b5c628d2bd705cd4 /src/mongo/bson/bsonelement.h
parent5efe0c6cae4a47c0ccafa8b17d7828283d77fbd6 (diff)
downloadmongo-aa3247ba48f78f4423874f2a64f00b12bf0b27d6.tar.gz
Move BSON hashing functionality into BSONObj and BSONElement
Diffstat (limited to 'src/mongo/bson/bsonelement.h')
-rw-r--r--src/mongo/bson/bsonelement.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/bson/bsonelement.h b/src/mongo/bson/bsonelement.h
index 67b345545ba..a5937349399 100644
--- a/src/mongo/bson/bsonelement.h
+++ b/src/mongo/bson/bsonelement.h
@@ -400,6 +400,15 @@ namespace mongo {
*/
int woCompare( const BSONElement &e, bool considerFieldName = true ) const;
+ /**
+ * Functor compatible with std::hash for std::unordered_{map,set}
+ * Warning: The hash function is subject to change. Do not use in cases where hashes need
+ * to be consistent across versions.
+ */
+ struct Hasher {
+ size_t operator() (const BSONElement& elem) const;
+ };
+
const char * rawdata() const { return data; }
/** 0 == Equality, just not defined yet */