Boost logo

Boost :

Subject: Re: [boost] [variant] Please vote for behavior
From: Dave Abrahams (dave_at_[hidden])
Date: 2013-01-25 19:08:09


on Fri Jan 25 2013, Krzysztof Czainski <1czajnik-AT-gmail.com> wrote:

> So to me the question is: should move introduce an "uninitialized" state
> for types that don't have one in the first place.

Only if you're willing to break code.

> Int has an uninitialized state. Iterators in std algorithms are
> allowed to have such a state too. And now we have moved-from objects
> - should they be allowed an additional "uninitialized" state? I
> answer yes, because moved-from objects must not be used for anything
> other than destruction or assignment-to.

The part after "because" is your assertion, but is not an absolute
truth. Furthermore, the destructor may depend on (e.g. check) the
invariant you've broken by introducing the "uninitialized" state.

-- 
Dave Abrahams
BoostPro Computing                  Software Development        Training
http://www.boostpro.com             Clang/LLVM/EDG Compilers  C++  Boost

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk