From 00d841bfda5dea2d21261bdefa62c9274554bd05 Mon Sep 17 00:00:00 2001 From: Jay Sistar Date: Thu, 11 May 2017 14:50:59 +0000 Subject: [PATCH] Adding equal and not equal operators to proxys. --- src/json.hpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/json.hpp b/src/json.hpp index a4e1275ea..b799f63bb 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -7894,6 +7894,20 @@ class basic_json { return proxy.key(); } + + /// equal operator (calls key()) + template + bool operator==(const KeyType& key) + { + return proxy.key() == key; + } + + /// not equal operator (calls key()) + template + bool operator!=(const KeyType& key) + { + return proxy.key() != key; + } }; /// helper class for second "property" @@ -7914,6 +7928,20 @@ class basic_json return proxy.value(); } + /// equal operator (calls value()) + template + bool operator==(const ValueType& value) + { + return proxy.value() == value; + } + + /// not equal operator (calls value()) + template + bool operator!=(const ValueType& value) + { + return proxy.value() != value; + } + /// assignment operator (calls value()) template iterator_value_property& operator=(const ValueType& value)