Boost logo

Boost :

Subject: Re: [boost] [outcome] To variant, or not to variant?
From: Peter Dimov (lists_at_[hidden])
Date: 2017-05-31 15:19:05


Andrzej Krzemienski wrote:

> What when `if_empty() == true`?

Nothing, I don't have an empty state.

> > Proposed additional narrow:
> >
> > // nullptr when !has_value(), otherwise &value_
> > T* operator->() noexcept;
> > T const* operator->() const noexcept;
>
> This is not narrow: this is wide. I disagree.

Why do you disagree?

> > // *operator->()
> > T& operator() & noexcept;
> > T const& operator() const & noexcept;
> > T&& operator() && noexcept;
> > T const&& operator() const && noexcept;
>
> This is operator*, right? This is technically narrow, but without
> essential benefits of direct narrow contract, as I tried to explain in
> another thread. I disagree.

What essential benefits are lost?


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