📝 add more examples

This commit is contained in:
Niels Lohmann 2022-05-10 19:54:09 +02:00
parent 02ff16f645
commit 875e9a3768
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
3 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,13 @@
#include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
json* j = new json("Hello, world!");
std::cout << *j << std::endl;
// explicitly call destructor
delete j;
}

View File

@ -0,0 +1 @@
"Hello, world!"

View File

@ -14,6 +14,22 @@ No-throw guarantee: this member function never throws exceptions.
Linear.
## Examples
??? example
The following code shows an example for the destructor.
```cpp
--8<-- "examples/~basic_json.cpp"
```
Output:
```json
--8<-- "examples/~basic_json.output"
```
## Version history
- Added in version 1.0.0.