Boost logo

Boost :

Subject: Re: [boost] [outcome] To variant, or not to variant?
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-06-01 18:49:43


On 01/06/2017 19:30, Peter Dimov via Boost wrote:
> Robert Ramey wrote:
>> or
>>
>> template<class T>
>> struct outcome : public std::variant<T, std::error_code> {
>> // some special member functions
>> outcome(const std::error_code & e){...} // construct as error
>> outcome(const T & t){...} // construct legitimate result
>> };
>
> Something like this?
>
> https://github.com/pdimov/variant2/blob/develop/include/boost/variant2/result.hpp

Hmm, maybe you could also implement expected<T, E>, and that would kinda
eliminate the need for a Boost.Outcome?

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/

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