mirror of
https://github.com/boostorg/variant2.git
synced 2025-07-29 19:57:18 +02:00
Add changelog, design, implementation sections
This commit is contained in:
@ -17,6 +17,9 @@ Peter Dimov
|
||||
:leveloffset: +1
|
||||
|
||||
include::variant2/overview.adoc[]
|
||||
include::variant2/changelog.adoc[]
|
||||
include::variant2/design.adoc[]
|
||||
include::variant2/implementation.adoc[]
|
||||
include::variant2/reference.adoc[]
|
||||
include::variant2/copyright.adoc[]
|
||||
|
||||
|
18
doc/variant2/changelog.adoc
Normal file
18
doc/variant2/changelog.adoc
Normal file
@ -0,0 +1,18 @@
|
||||
////
|
||||
Copyright 2019 Peter Dimov
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt
|
||||
////
|
||||
|
||||
[#changelog]
|
||||
# Revision History
|
||||
:idprefix: changelog_
|
||||
|
||||
## Changes in 1.71.0
|
||||
|
||||
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.
|
54
doc/variant2/design.adoc
Normal file
54
doc/variant2/design.adoc
Normal file
@ -0,0 +1,54 @@
|
||||
////
|
||||
Copyright 2018, 2019 Peter Dimov
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt
|
||||
////
|
||||
|
||||
[#design]
|
||||
# Design
|
||||
:idprefix: design_
|
||||
|
||||
## Features
|
||||
|
||||
This `variant` implementation has two distinguishing features:
|
||||
|
||||
* It's never "valueless", that is, `variant<T1, T2, ..., Tn>` has an
|
||||
invariant that it always contains a valid value of one of the types
|
||||
`T1`, `T2`, ..., `Tn`.
|
||||
* It provides the strong exception safety guarantee on assignment and
|
||||
`emplace`.
|
||||
|
||||
This is achieved with the use of double storage, unless all of the
|
||||
contained types have a non-throwing move constructor.
|
||||
|
||||
## Rationale
|
||||
|
||||
...
|
||||
|
||||
## Differences with std::variant
|
||||
|
||||
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.
|
||||
* `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
|
||||
* 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
|
||||
represented.)
|
||||
* `variant<T...>` is not (yet) trivial when all contained types are trivial,
|
||||
as mandated by {cpp}17.
|
||||
* The {cpp}20 additions and changes to `std::variant` have not yet been
|
||||
implemented.
|
||||
|
||||
## Differences with Boost.Variant
|
||||
|
||||
...
|
25
doc/variant2/implementation.adoc
Normal file
25
doc/variant2/implementation.adoc
Normal file
@ -0,0 +1,25 @@
|
||||
////
|
||||
Copyright 2019 Peter Dimov
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt
|
||||
////
|
||||
|
||||
[#implementation]
|
||||
# Implementation
|
||||
:idprefix: implementation_
|
||||
|
||||
## Dependencies
|
||||
|
||||
This implementation 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
|
||||
|
||||
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