Add changelog, design, implementation sections

This commit is contained in:
Peter Dimov
2019-05-12 00:15:17 +03:00
parent 5011dd8e1c
commit 475ad691d6
4 changed files with 100 additions and 0 deletions

View File

@ -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[]

View 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
View 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
...

View 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].