Boost logo

Boost :

Subject: Re: [boost] [outcome] To variant, or not to variant?
From: Robert Ramey (ramey_at_[hidden])
Date: 2017-06-01 22:07:16

On 6/1/17 11:30 AM, 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?

Probably I suppose ....

But this isn't really my point. The point I'm trying to make is that
all the design disputes are also found in variant. It would seem to me
that we're repeating all the same arguments ... with pretty much similar
results. If the problem is that variant (std, boost, ...) is "broken"
or not suitable for that reason it would seem to me that THAT problem
would need to be addressed. Were that the case, then all the issues
with outcome, optional, result, expected would disappear. Maybe I'm
over simplifying here, so feel free to demonstrate I'm wrong. In any
case, I would think that if a consensus can't be agreed upon after all
this effort, maybe we should step back and except as a fact that
"concensus cannot be reached". So we'll permit variant implementations
of variant either with policy or simpler yet, just a separate
implementation. Of course these separate implementations would also
share a common base class so we get nested russian dolls. But at least
we don't get so much repetition.

Robert Ramey

Boost list run by bdawes at, gregod at, cpdaniel at, john at