mirror of
https://github.com/ToruNiina/toml11.git
synced 2024-11-24 05:10:16 +00:00
chore: update README; about literals
This commit is contained in:
parent
81deb8efde
commit
789d784769
10
README.md
10
README.md
@ -603,9 +603,11 @@ toml::value operator""_toml(const char* str, std::size_t len);
|
||||
Access to the operator can be gained with `using namespace toml::literals;`,
|
||||
`using namespace toml::toml_literals`, and `using namespace toml::literals::toml_literals`.
|
||||
|
||||
Note that since it allows a bare value without a key, it is difficult to distinguish
|
||||
arrays and table definitions.
|
||||
Currently, it parses `[1]` as a table definition if there are no commas.
|
||||
Note that a key that is composed only of digits is allowed in TOML.
|
||||
And, unlike the file parser, toml-literal allows a bare value without a key.
|
||||
Thus it is difficult to distinguish arrays having integers and definitions of
|
||||
tables that are named as digits.
|
||||
Currently, literal `[1]` becomes a table named "1".
|
||||
To ensure a literal to be considered as an array with one element, you need to
|
||||
add a comma after the first element (like `[1,]`).
|
||||
|
||||
@ -615,7 +617,7 @@ add a comma after the first element (like `[1,]`).
|
||||
"[[1,2,3]]"_toml; // This is an array of arrays
|
||||
"[[table]]"_toml; // This is a table that has an array of tables inside.
|
||||
|
||||
"[[1]]"_toml; // This is ambiguous.
|
||||
"[[1]]"_toml; // This literal is ambiguous.
|
||||
// Currently, it becomes a table taht has array of table "1".
|
||||
"1 = [{}]"_toml; // This is a table that has an array of table named 1.
|
||||
"[[1,]]"_toml; // This is an array of arrays.
|
||||
|
Loading…
Reference in New Issue
Block a user