forked from boostorg/variant2
Update documentation
This commit is contained in:
1 parent
64ea067c79
commit
cacd99d69d
4 files changed
+188
-7
No files matched your search
@@ -15,4 +15,4 @@ http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
After the Boost formal review, the implementation has been
|
||||
changed to provide the strong exception safety guarantee,
|
||||
instead of basic. `expected` has been removed, for now.
|
||||
instead of basic. `expected` has been removed.
|
||||
@@ -26,6 +26,12 @@ contained types have a non-throwing move constructor.
|
||||
|
||||
## Rationale
|
||||
|
||||
### Never Valueless
|
||||
|
||||
...
|
||||
|
||||
### Strong Exception Safety
|
||||
|
||||
...
|
||||
|
||||
## Differences with std::variant
|
||||
@@ -34,12 +40,12 @@ The main differences between this implementation and `std::variant` are:
|
||||
|
||||
* No valueless-by-exception state: `valueless_by_exception()` always
|
||||
returns `false`.
|
||||
* Strong exception safety guarantee.
|
||||
* Strong exception safety guarantee on assignment and `emplace`.
|
||||
* `emplace` first constructs the new value and then destroys the old one;
|
||||
in the single storage case, this translates to constructing a temporary
|
||||
and then moving it into place.
|
||||
* A converting constructor from, e.g. `variant<int, float>` to
|
||||
`variant<float, double, int>` is provided as an extension
|
||||
`variant<float, double, int>` is provided as an extension.
|
||||
* The reverse operation, going from `variant<float, double, int>` to
|
||||
`variant<int, float>` is provided as the member function `subset<U...>`.
|
||||
(This operation can throw if the current state of the variant cannot be
|
||||
@@ -51,4 +57,12 @@ The main differences between this implementation and `std::variant` are:
|
||||
|
||||
## Differences with Boost.Variant
|
||||
|
||||
...
|
||||
This library is API compatible with `std::variant`. As such, its interface
|
||||
is different from Boost.Variant's. For example, visitation is performed via
|
||||
`visit` instead of `apply_visitor`.
|
||||
|
||||
Recursive variants are not supported.
|
||||
|
||||
Double storage is used instead of temporary heap backup. This `variant` is
|
||||
always "stack-based", it never allocates, and never throws `bad_alloc` on
|
||||
its own.
|
||||
@@ -13,13 +13,13 @@ http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
## Dependencies
|
||||
|
||||
This implementation depends on Boost.Config and Boost.Mp11.
|
||||
This implementation only depends on Boost.Config and Boost.Mp11.
|
||||
|
||||
## Supported Compilers
|
||||
|
||||
* GCC 4.8 or later with `-std=c++11` or above
|
||||
* Clang 3.5 or later with `-std=c++11` or above
|
||||
* Visual Studio 2015, 2017
|
||||
* Visual Studio 2015, 2017, 2019
|
||||
|
||||
Tested on https://travis-ci.org/pdimov/variant2/[Travis] and
|
||||
https://ci.appveyor.com/project/pdimov/variant2/[Appveyor].
|
||||
Reference in new issue
Block a user