mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-17 00:38:08 +08:00
doc: update README
This commit is contained in:
15
README.md
15
README.md
@@ -792,12 +792,7 @@ std::vector<int> vec{1,2,3,4,5};
|
|||||||
toml::value v = vec;
|
toml::value v = vec;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
All the elements of `initializer_list` should be convertible into `toml::value`.
|
||||||
|
|
||||||
```cpp
|
|
||||||
toml::value v = vec;
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Preserving comments
|
## Preserving comments
|
||||||
|
|
||||||
@@ -864,10 +859,14 @@ a = [ # this is not a comment for a. this will be ignored.
|
|||||||
] # this is a comment for a.
|
] # this is a comment for a.
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also append comments. The interfaces are the same as `std::vector<std::string>`.
|
You can also append and modify comments.
|
||||||
|
The interfaces are the same as `std::vector<std::string>`.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
v.comments().push_back(" add new comment.");
|
toml::basic_value<toml::preserve_comments> v(42);
|
||||||
|
v.comments().push_back(" add this comment.");
|
||||||
|
// # add this comment.
|
||||||
|
// i = 42
|
||||||
```
|
```
|
||||||
|
|
||||||
When `toml::discard_comments` is chosen, comments will not be contained in a value.
|
When `toml::discard_comments` is chosen, comments will not be contained in a value.
|
||||||
|
Reference in New Issue
Block a user