|
Boost : |
Subject: Re: [boost] variant2 never empty guarantees
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-06-06 10:51:01
> You are basically saying: provide the implementation that gives me strong
> guarantee when I meet condition X. ("X" being up to one type with
> potentially throwing move constructor).
>
> Your expectation is reasonable, but (I think) it is incompatible with other
> peoples' expectation: provide implementation that gives me never-empty
> guarantee when I meet condition Y. ("Y" in that case means I have a type
> with nothrow default constructor.)
>
> I do not think both expectations can be satisfied in one implementation.
I think it daft that a variant require any default constructors at all.
My understanding of C++ 17 std::variant<> is that it does not require
any of its types to have default constructors.
I certainly feel no warmth to the idea of a variant which will default
construct to any of its possible states instead of to explicit
valueless. If I just lost previous state due to a throw during
assignment, I **want** that reflected in the variant state.
Much better still of course is that you don't lose me my previous state.
Niall
-- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk