Boost logo

Boost :

Subject: Re: [boost] [variant2] Review of Variant2 started today : April 1 - April 10
From: Peter Dimov (pdimov_at_[hidden])
Date: 2019-04-02 14:44:28


Andrey Semashev wrote:
> >> Also, IMHO, it's better to have libraries more focused and fine
> >> grained. Why not have `expected` as a separate library?
> >
> > expected<T, E...> is basically a variant, with a slightly different
> > interface.
>
> It might be implemented like/with variant, but conceptually this is a
> different component. Just like `optional` is a different component than
> `variant`. All these components have different use cases and communicate
> different intentions.

It is a different component. That wasn't the question though. The question
was, why not have it as a separate library. And the answer is, because the
two components share too much of an implementation, and because the design
decisions made about one component affect the other (and vice versa - the
converting constructor and the subset() member function of `variant` are
needed by `expected`).


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