From 6311f3df9f2de517b40ccf2dbd5a58776119c251 Mon Sep 17 00:00:00 2001 From: Yakov Markovitch Date: Fri, 14 Oct 2011 19:08:51 +0400 Subject: [PATCH] Add missing operator!= for BSONObj and BSONElement classes --- bson/bsonelement.h | 2 ++ bson/bsonobj.h | 1 + 2 files changed, 3 insertions(+) diff --git a/bson/bsonelement.h b/bson/bsonelement.h index 5487d8d389218..bf0ccc33199a1 100644 --- a/bson/bsonelement.h +++ b/bson/bsonelement.h @@ -308,6 +308,8 @@ namespace mongo { bool operator==(const BSONElement& r) const { return woCompare( r , true ) == 0; } + /** Returns true if elements are unequal. */ + bool operator!=(const BSONElement& r) const { return !operator==(r); } /** Well ordered comparison. @return <0: l0:l>r diff --git a/bson/bsonobj.h b/bson/bsonobj.h index 6adeb960887bf..e8ce462403b5d 100644 --- a/bson/bsonobj.h +++ b/bson/bsonobj.h @@ -370,6 +370,7 @@ namespace mongo { string md5() const; bool operator==( const BSONObj& other ) const { return equal( other ); } + bool operator!=(const BSONObj& other) const { return !operator==( other); } enum MatchType { Equality = 0,