mirror of
https://github.com/nlohmann/json.git
synced 2026-10-04 21:50:33 +00:00
Add operator<<(json_pointer) (#3601)
* Add operator<< for json_pointer * Deprecate json_pointer::operator string_t() * Update documentation * Move operator<<(basic_json) example * Add example * Add mkdocs-redirects * Move operator<< and operator>> doc pages out of basic_json/ * Rename JSON pointer operator_string to operator_string_t * Add unit test
This commit is contained in:
@@ -28,7 +28,7 @@ are the base for JSON patches.
|
||||
|
||||
- [(constructor)](json_pointer.md)
|
||||
- [**to_string**](to_string.md) - return a string representation of the JSON pointer
|
||||
- [**operator string_t**](operator_string.md) - return a string representation of the JSON pointer
|
||||
- [**operator string_t**](operator_string_t.md) - return a string representation of the JSON pointer
|
||||
- [**operator/=**](operator_slasheq.md) - append to the end of the JSON pointer
|
||||
- [**operator/**](operator_slash.md) - create JSON Pointer by appending
|
||||
- [**parent_pointer**](parent_pointer.md) - returns the parent of this JSON pointer
|
||||
|
||||
+10
-3
@@ -19,6 +19,13 @@ operator string_t() const
|
||||
}
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
!!! warning "Deprecation"
|
||||
|
||||
This function is deprecated in favor of [`to_string`](to_string.md) and will be removed in a future major version
|
||||
release.
|
||||
|
||||
## Examples
|
||||
|
||||
??? example
|
||||
@@ -26,16 +33,16 @@ operator string_t() const
|
||||
The example shows how JSON Pointers can be implicitly converted to strings.
|
||||
|
||||
```cpp
|
||||
--8<-- "examples/json_pointer__operator_string.cpp"
|
||||
--8<-- "examples/json_pointer__operator_string_t.cpp"
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```json
|
||||
--8<-- "examples/json_pointer__operator_string.output"
|
||||
--8<-- "examples/json_pointer__operator_string_t.output"
|
||||
```
|
||||
|
||||
## Version history
|
||||
|
||||
- Since version 2.0.0.
|
||||
- Changed type to `string_t` in version 3.11.0.
|
||||
- Changed type to `string_t` and deprecated in version 3.11.0.
|
||||
Reference in New Issue
Block a user