Boost logo

Boost :

Subject: Re: [boost] Strong guarantee variant (Was: Outcome/expected/etc/etc/etc)
From: Peter Dimov (lists_at_[hidden])
Date: 2017-06-08 12:59:04


Andrzej Krzemienski wrote:
> 2017-06-06 14:20 GMT+02:00 Peter Dimov via Boost <boost_at_[hidden]>:
>
> > Types don't generally provide the strong guarantee on assignment as it
> > doesn't compose. If type T has strong assign, type U has strong assign,
> > struct { T t; U u; } no longer does. So it's more efficient to just do
> > basic everywhere, which does compose, and then at the specific point you
> > want the strong guarantee, use f.ex. the copy and swap trick to get it.
>
>
> I think the reasoning behind Niall's position is that a type `X` can have
> a custom guarantee: upon its assignment it guarantees that after a throw
> the type is either unchanged or goes to fallback state `0`. This guarantee
> is
stronger than basic, and weaker than strong.

Types _could_ provide such a guarantee, but don't, for the same reason they
don't provide strong - as outlined in the quoted paragraph above, if types X
and Y provide it, struct { X x; Y y; } no longer does. So it's additional
work, and buys nothing much.


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