Adding equal and not equal operators to proxys.
This commit is contained in:
parent
d6c78dacd8
commit
00d841bfda
1 changed files with 28 additions and 0 deletions
28
src/json.hpp
28
src/json.hpp
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue