1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-31 10:24:23 +03:00

📝 add more API documentation

This commit is contained in:
Niels Lohmann
2020-08-16 20:48:10 +02:00
parent a430d25f22
commit 5c4cc20ed8
5 changed files with 124 additions and 2 deletions

View File

@ -194,9 +194,9 @@ Access to the JSON value
- [**operator==**](operator==.md) - comparison: equal
- [**operator!=**](operator!=.md) - comparison: not equal
- [**operator<**](operator<.md) - comparison: less than
- operator<= - comparison: less than or equal
- [**operator<=**](operator<=.md) - comparison: less than or equal
- [**operator>**](operator>.md) - comparison: greater than
- operator>= - comparison: greater than or equal
- [**operator>=**](operator>=.md) - comparison: greater than or equal
### Serialization

View File

@ -0,0 +1,59 @@
# basic_json::operator<=
```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 whether one JSON value `lhs` is less than or equal to another JSON value `rhs` by calculating
`#cpp !(rhs < lhs)`.
## 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 `lhs` is less than or equal to `rhs`
## Exception safety
No-throw guarantee: this function never throws exceptions.
## Complexity
Linear.
## Example
??? example
The example demonstrates comparing several JSON types.
```cpp
--8<-- "examples/operator__lessequal.cpp"
```
Output:
```json
--8<-- "examples/operator__lessequal.output"
```
## Version history
- Added in version 1.0.0.

View File

@ -0,0 +1,59 @@
# basic_json::operator>=
```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 whether one JSON value `lhs` is greater than or equal to another JSON value `rhs` 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 `lhs` is less than or equal to `rhs`
## Exception safety
No-throw guarantee: this function never throws exceptions.
## Complexity
Linear.
## Example
??? example
The example demonstrates comparing several JSON types.
```cpp
--8<-- "examples/operator__greaterequal.cpp"
```
Output:
```json
--8<-- "examples/operator__greaterequal.output"
```
## Version history
- Added in version 1.0.0.