git » nmdb » commit b1c18cc

Implement the 'in' operator for D's nmdb class.

author Alberto Bertogli
2007-03-29 00:29:12 UTC
committer Alberto Bertogli
2007-03-29 00:29:12 UTC
parent 03a87c130f238aed989ca5105c956a5c6ae27e8e

Implement the 'in' operator for D's nmdb class.

d/nmdb.d +10 -0

diff --git a/d/nmdb.d b/d/nmdb.d
index f69344f..8d4dc13 100644
--- a/d/nmdb.d
+++ b/d/nmdb.d
@@ -173,5 +173,15 @@ class DB
 		return set(key, val);
 	}
 
+	bool opIn_r(char[] key)
+	{
+		try {
+			get(key);
+		} catch (KeyNotFound(s)) {
+			return false;
+		}
+		return true;
+	}
+
 }