Boost logo

Boost :

Subject: Re: [boost] variant2 - really dumb way off topic question here
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2019-02-28 13:29:40

sob., 23 lut 2019 o 01:12 Robert Ramey via Boost <boost_at_[hidden]>

> On 2/22/19 9:48 AM, Peter Dimov via Boost wrote:
> > I'd like to request a formal Boost review for the Variant2 library,
> > Variant2 contains an implementation
> > of a
> > variant<T...> type that is an almost conforming std::variant, except it
> > doesn't require C++17 and supports C++11 and above.
> >
> > It's also never valueless and has a few other extensions.
> I see optional, expected, outcome and .. (monad?) as just special cases
> of variant. for example
> template<typename T>
> using optional = variant<false_type, T>;
> Why is it necessary to have all these type implemented? Can't there be
> some sort of "base" type which can be used to implement all these others?

I think it is about the interfaces and guarantees. optional provides
.value_or(), .map() functions, and operators, like ->. Also, because it
does not have to consider the assignment of mixed types its implementation
is more lightweight and therefore compiles faster and introduces fewer


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