|
Boost : |
Subject: Re: [boost] Interest in an 'either' library?
From: David Sankel (camior_at_[hidden])
Date: 2013-06-22 09:11:38
On Fri, Jun 21, 2013 at 4:42 PM, Mathias Gaunard <
mathias.gaunard_at_[hidden]> wrote:
> On 21/06/13 18:35, David Sankel wrote:
>
>> **semantics**:
>>
>> template< typename left_type, typename right_type>
>> struct either
>> {
>> // postcondition, is_left()
>> either( left_type );
>>
>> // postcondition, is_right()
>> either( right_type );
>>
>> bool is_left() const;
>> bool is_right() const;
>>
>> // postcondition, is_left()
>> either & operator=( left_type );
>>
>
> What happens if the 'either' originally contained a right_type and that
> the copy/move constructor of left_type throws?
Good question. I think the tradeoffs that were made with Boost.Variant in
that case would work just as well 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