mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-17 09:08:08 +08:00
fix: "Finding a value in an array" example in README
This commit is contained in:
@@ -266,11 +266,11 @@ shape = "round"
|
|||||||
``` cpp
|
``` cpp
|
||||||
const auto data = toml::parse("fruit.toml");
|
const auto data = toml::parse("fruit.toml");
|
||||||
const auto& fruit = toml::find(data, "fruit");
|
const auto& fruit = toml::find(data, "fruit");
|
||||||
const auto name = toml::find<std::string>(fruit, "apple");
|
const auto name = toml::find<std::string>(fruit, "name");
|
||||||
|
|
||||||
const auto& physical = toml::find(fruit, "physical");
|
const auto& physical = toml::find(fruit, "physical");
|
||||||
const auto color = toml::find<std::string>(fruit, "color");
|
const auto color = toml::find<std::string>(physical, "color");
|
||||||
const auto shape = toml::find<std::string>(fruit, "shape");
|
const auto shape = toml::find<std::string>(physical, "shape");
|
||||||
```
|
```
|
||||||
|
|
||||||
Here, variable `fruit` is a `toml::value` and can be used as the first argument
|
Here, variable `fruit` is a `toml::value` and can be used as the first argument
|
||||||
|
Reference in New Issue
Block a user