1
0
mirror of https://github.com/nlohmann/json synced 2024-11-30 23:50:08 +00:00

Adding equal and not equal operators to proxys.

This commit is contained in:
Jay Sistar 2017-05-11 14:50:59 +00:00
parent d6c78dacd8
commit 00d841bfda

View File

@ -7894,6 +7894,20 @@ class basic_json
{
return proxy.key();
}
/// equal operator (calls key())
template<typename KeyType>
bool operator==(const KeyType& key)
{
return proxy.key() == key;
}
/// not equal operator (calls key())
template<typename KeyType>
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<typename ValueType>
bool operator==(const ValueType& value)
{
return proxy.value() == value;
}
/// not equal operator (calls value())
template<typename ValueType>
bool operator!=(const ValueType& value)
{
return proxy.value() != value;
}
/// assignment operator (calls value())
template<typename ValueType>
iterator_value_property<ProxyType>& operator=(const ValueType& value)