
AMDG Giovanni Piero Deretta wrote:
On Thu, Jul 24, 2008 at 4:58 PM, Mathias Gaunard <mathias.gaunard@ens-lyon.org> wrote: <snip>
T::T(T&& o) could make 'o' empty, but there could be no other way to make 'o' empty otherwise.
I think that the biggest problem is that, if T is movable, you cannot statically guarantee that T is never accessed in an empty state, so the never empty guarantee is not as useful.
Upon further reflection, the never empty guarantee is not useful at all for Boost.Function. Suppose that Boost.Function does not provide such a guarantee and I have a boost::function that I want to call. What can I assume? I obviously can't assume that it won't throw, because it will throw if it is empty. This is not changed by adding the never empty guarantee. Nothing prevents a boost::function from holding a function object that throws when it is called. The only invariant that is added by the never empty guarantee is that f.target_type() != typeid(void). I don't see this as being useful. In Christ, Steven Watanabe