Subject: Re: [boost] Interest in an 'either' library?
From: David Sankel (camior_at_[hidden])
Date: 2013-06-24 00:26:20
On Sun, Jun 23, 2013 at 5:07 AM, Mathias Gaunard <
> On 22/06/13 15:11, David Sankel wrote:
> Good question. I think the tradeoffs that were made with Boost.Variant in
>> that case would work just as well here.
> Don't you already have an implementation? What does it do?
I do, now that you ask, at https://github.com/camio/Boost.Either. This
reference implementation uses Boost.Variant as a back-end and thus inherits
a lot of its behavior.
Let me try to summarize what precisely happens in the case you were
originally inquiring upon (what happens with exceptions in assignments):
1. For types where this can happen, the resulting state will still have
all the invariants of the either type met. That is, it will always refer to
either a 'left' or a 'right' value.
2. Because of point one, the use of internal types that have throwing
assignments may incur an allocation during these operations in order to
ensure #1 is met.
3. Ways will be provided to workaround the overhead in #2 for capable
More details here:
-- David Sankel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk