Boost logo

Boost :

Subject: Re: [boost] variant2 never empty guarantees
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-06-13 08:34:15


On 13/06/2017 19:31, Andrzej Krzemienski wrote:
> First of all. I haven't seen anyone give an example where they need a
> strong guarantee for variant's assignment. There was one attempt with a
> state machine, but even there it seamed only theoretical. I think the
> questions if we can implement it are secondary to if anyone really needs it.

Actually the state machine example was a thought exercise that (I think)
proved a strong guarantee was *not* useful for that case.

> If whoever has a real (as opposed to theoretical) need for a strong
> guarantee, please respond.

I think the first barrier is that someone needs to come up with a case
where a strong guarantee on assignment for *any* type (not variant) is
useful.

Once some type T needs it, it would become easier to argue that
variant<T, ...> should provide it as well (due to the desire that a
variant containing a T should act as much like a T as possible). I'm
still not entirely sure I'd agree with that argument, but at least it
becomes possible to have that argument with something concrete in mind.


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