🚧 added section on deprecated constructor
1 parent
2d9d8250d2
commit
861efac403
1 file changed
+35
-1
+35
-1
@@ -13,4 +13,38 @@ In case of bugs, there may be another 2.x.x release. However, pushing forward ve
|
||||
|
||||
# Changes
|
||||
|
||||
This section shall list the changes that have been made past version 2.1.1. If possible, we shall provide examples how to change existing tools to work with the 3.0.0 release.
|
||||
This section shall list the changes that have been made past version 2.1.1. If possible, we shall provide examples how to change existing tools to work with the 3.0.0 release.
|
||||
|
||||
## Removal of deprecated input stream constructor
|
||||
|
||||
[Issue 480](https://github.com/nlohmann/json/issues/480) describes the removal of constructor `explicit basic_json(std::istream& i, const parser_callback_t cb = nullptr)`.
|
||||
|
||||
### Code changes
|
||||
|
||||
New code should use the `parse()` function. Let `ss` be a stream and `cb` be a parse callback function.
|
||||
|
||||
Old code:
|
||||
|
||||
```cpp
|
||||
json j(ss, cb);
|
||||
```
|
||||
|
||||
New code:
|
||||
|
||||
```cpp
|
||||
json j = json::parse(ss, cb);
|
||||
```
|
||||
|
||||
If no callback function is used, also the following code works:
|
||||
|
||||
```cpp
|
||||
json j;
|
||||
j << ss;
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```cpp
|
||||
json j;
|
||||
ss >> j;
|
||||
```
|
||||
Reference in new issue
Block a user