2021-12-29 15:41:01 +03:00
|
|
|
# <small>nlohmann::basic_json::</small>operator!=
|
2020-08-12 14:41:59 +03:00
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
bool operator!=(const_reference lhs, const_reference rhs) noexcept;
|
|
|
|
|
|
|
|
|
|
template<typename ScalarType>
|
|
|
|
|
bool operator!=(const_reference lhs, const ScalarType rhs) noexcept;
|
|
|
|
|
|
|
|
|
|
template<typename ScalarType>
|
|
|
|
|
bool operator!=(ScalarType lhs, const const_reference rhs) noexcept;
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Compares two JSON values for inequality by calculating `#!cpp !(lhs == rhs)`.
|
|
|
|
|
|
|
|
|
|
## Template parameters
|
|
|
|
|
|
|
|
|
|
`ScalarType`
|
|
|
|
|
: a scalar type according to `std::is_scalar<ScalarType>::value`
|
|
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
|
|
`lhs` (in)
|
|
|
|
|
: first value to consider
|
|
|
|
|
|
|
|
|
|
`rhs` (in)
|
|
|
|
|
: second value to consider
|
|
|
|
|
|
|
|
|
|
## Return value
|
|
|
|
|
|
|
|
|
|
whether the values `lhs` and `rhs` are not equal
|
|
|
|
|
|
|
|
|
|
## Exception safety
|
|
|
|
|
|
|
|
|
|
No-throw guarantee: this function never throws exceptions.
|
|
|
|
|
|
|
|
|
|
## Complexity
|
|
|
|
|
|
|
|
|
|
Linear.
|
|
|
|
|
|
2021-12-29 15:41:01 +03:00
|
|
|
## Examples
|
2020-08-12 14:41:59 +03:00
|
|
|
|
2021-12-29 15:41:01 +03:00
|
|
|
??? example
|
|
|
|
|
|
|
|
|
|
The example demonstrates comparing several JSON types.
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
--8<-- "examples/operator__notequal.cpp"
|
|
|
|
|
```
|
2020-08-12 14:41:59 +03:00
|
|
|
|
2021-12-29 15:41:01 +03:00
|
|
|
Output:
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
--8<-- "examples/operator__notequal.output"
|
|
|
|
|
```
|
2020-08-12 14:41:59 +03:00
|
|
|
|
2021-12-29 15:41:01 +03:00
|
|
|
??? example
|
2020-08-12 14:41:59 +03:00
|
|
|
|
2021-12-29 15:41:01 +03:00
|
|
|
The example demonstrates comparing several JSON types against the null pointer (JSON `#!json null`).
|
|
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
|
--8<-- "examples/operator__notequal__nullptr_t.cpp"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Output:
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
--8<-- "examples/operator__notequal__nullptr_t.output"
|
|
|
|
|
```
|
2020-08-12 14:41:59 +03:00
|
|
|
|
|
|
|
|
## Version history
|
|
|
|
|
|
|
|
|
|
- Added in version 1.0.0.
|