From 2164fd39f7ca0c4ea8fad0078a8127bd47990e0d Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sun, 21 Jun 2020 14:00:03 +0900 Subject: [PATCH] doc: explain about the type of the top-level value fix #120. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index fc58f7e..2c7f1a4 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,9 @@ const std::string fname("sample.toml"); const toml::value data = toml::parse(fname); ``` +As required by the TOML specification, the top-level value is always a table. +You can find a value inside it, cast it into a table explicitly, and insert it as a value into other `toml::value`. + If it encounters an error while opening a file, it will throw `std::runtime_error`. You can also pass a `std::istream` to the `toml::parse` function.