Boost logo

Boost :

Subject: Re: [boost] Interest in an 'either' library?
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2013-06-23 12:25:59


On 23 Jun 2013 13:12, "Mathias Gaunard" <mathias.gaunard_at_[hidden]>
wrote:
> On 23/06/13 13:45, Mateusz Loskot wrote:
>> On 21 Jun 2013 17:36, "David Sankel" <camior_at_[hidden]> wrote:
>>>
>>> **Use 2**: A lightweight alternative to boost::variant when only 2
>>> components are required (either relates to variant in a similar way that
>>> pair relates to tuple ).
>>> (...)
>>>
>>> either<A,B> eitherAOrB;
>>>
>>> if( eitherAOrB.is_left() )
>>> std::cout << "A: " << eitherAOrB.left();
>>> else
>>> std::cout << "B: " << eitherAOrB.right();
>>
>>
>> Is there any particular reason not to follow std::pair naming
>> and use first() and second() members?
>
>
> first()/second() implies a sequence with at least two elements.

Good point, thanks.

-- 
Mateusz Loskot, http://mateusz.loskot.net

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