doc: update README for v1-rc1

This commit is contained in:
ToruNiina
2020-04-03 23:45:45 +09:00
parent 7c07f4382c
commit bf992e8f94

View File

@@ -10,8 +10,7 @@ toml11
toml11 is a C++11 (or later) header-only toml parser/encoder depending only on C++ standard library. toml11 is a C++11 (or later) header-only toml parser/encoder depending only on C++ standard library.
- It is compatible to the latest version of [TOML v0.5.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.5.0.md). - It is compatible to the latest version of [TOML v1.0.0-rc.1](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v1.0.0-rc.1.md).
- It optionally supports the [unreleased features](#unreleased-toml-features) in the master branch of toml-lang/toml.
- It is one of the most TOML standard compliant libraries, tested with [the language agnostic test suite for TOML parsers by BurntSushi](https://github.com/BurntSushi/toml-test). - It is one of the most TOML standard compliant libraries, tested with [the language agnostic test suite for TOML parsers by BurntSushi](https://github.com/BurntSushi/toml-test).
- It shows highly informative error messages. You can see the error messages about invalid files at [CircleCI](https://circleci.com/gh/ToruNiina/toml11). - It shows highly informative error messages. You can see the error messages about invalid files at [CircleCI](https://circleci.com/gh/ToruNiina/toml11).
- It has configurable container. You can use any random-access containers and key-value maps as backend containers. - It has configurable container. You can use any random-access containers and key-value maps as backend containers.
@@ -1652,13 +1651,8 @@ not capable of representing a Local Time independent from a specific day.
## Unreleased TOML features ## Unreleased TOML features
There are some unreleased features in toml-lang/toml:master. Since TOML v1.0.0-rc.1 has been released, those features are now activated by
Currently, the following features are available after defining default. We no longer need to define `TOML11_USE_UNRELEASED_FEATURES`.
`TOML11_USE_UNRELEASED_TOML_FEATURES` macro flag.
To use those features, `#define` `TOML11_USE_UNRELEASED_TOML_FEATURES` before
including `toml.hpp` or pass `-DTOML11_USE_UNRELEASED_TOML_FEATURES` to your
compiler.
- Leading zeroes in exponent parts of floats are permitted. - Leading zeroes in exponent parts of floats are permitted.
- e.g. `1.0e+01`, `5e+05` - e.g. `1.0e+01`, `5e+05`
@@ -1668,10 +1662,10 @@ compiler.
- Allow heterogeneous arrays - Allow heterogeneous arrays
- [toml-lang/toml/PR/676](https://github.com/toml-lang/toml/pull/676) - [toml-lang/toml/PR/676](https://github.com/toml-lang/toml/pull/676)
### Note about heterogeneous arrays ## Note about heterogeneous arrays
Although `toml::parse` allows heterogeneous arrays, constructor of `toml::value` Although `toml::parse` allows heterogeneous arrays, constructor of `toml::value`
does not. does not. Here the reason is explained.
```cpp ```cpp
// this won't be compiled // this won't be compiled
@@ -1680,8 +1674,10 @@ toml::value v{
} }
``` ```
There is a workaround for this issue. By explicitly converting values into There is a workaround for this. By explicitly converting values into
`toml::value`, you can initialize `toml::value` with a heterogeneous array. `toml::value`, you can initialize `toml::value` with a heterogeneous array.
Also, you can first initialize a `toml::value` with an array and then
`push_back` into it.
```cpp ```cpp
// OK! // OK!
@@ -1689,6 +1685,17 @@ toml::value v{
toml::value("foo"), toml::value(3.14), toml::value(42), toml::value("foo"), toml::value(3.14), toml::value(42),
toml::value{1,2,3,4,5}, toml::value{{"key", "value"}} toml::value{1,2,3,4,5}, toml::value{{"key", "value"}}
} }
// OK!
toml::value v(toml::array{});
v.push_back("foo");
v.push_back(3.14);
// OK!
toml::array a;
a.push_back("foo");
a.push_back(3.14);
toml::value v(std::move(a));
``` ```
The reason why the first example is not allowed is the following. The reason why the first example is not allowed is the following.
@@ -1717,15 +1724,14 @@ This means that the above C++ code makes constructor's overload resolution
ambiguous. So a constructor that allows both "table as an initializer-list" and ambiguous. So a constructor that allows both "table as an initializer-list" and
"heterogeneous array as an initializer-list" cannot be implemented. "heterogeneous array as an initializer-list" cannot be implemented.
Thus, although it is painful, you need to explicitly cast values into Thus, although it is painful, we need to explicitly cast values into
`toml::value` when you initialize heterogeneous array in C++ code. `toml::value` when you initialize heterogeneous array in a C++ code.
```cpp ```cpp
// You need to do this when you want to initialize hetero array.
toml::value v{ toml::value v{
toml::value("foo"), toml::value(3.14), toml::value(42), toml::value("foo"), toml::value(3.14), toml::value(42),
toml::value{1,2,3,4,5}, toml::value{{"key", "value"}} toml::value{1,2,3,4,5}, toml::value{{"key", "value"}}
} };
``` ```
## Breaking Changes from v2 ## Breaking Changes from v2