From d3de13656205d31c347d35d1aaba333fe893099d Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Mon, 25 Jan 2021 17:25:29 +0900 Subject: [PATCH] doc: simplity example code a bit --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fcc4b0e..f2ce9e3 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,10 @@ toml11 is a C++11 (or later) header-only toml parser/encoder depending only on C int main() { + // ```toml + // title = "an example toml file" + // nums = [3, 1, 4, 1, 5] + // ``` auto data = toml::parse("example.toml"); // find a value with the specified type from a table @@ -37,9 +41,9 @@ int main() std::vector nums = toml::find>(data, "nums"); // access with STL-like manner - if(not data.at("a").contains("b")) + if(not data.contains("foo")) { - data["a"]["b"] = "c"; + data["foo"] = "bar"; } // pass a fallback