Boost logo

Boost :

Subject: Re: [boost] [outcome] outcome without empty state?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2017-05-25 16:01:34


Le 25/05/2017 à 14:25, Jonathan Müller via Boost a écrit :
> On May 25, 2017 12:13, "Vicente J. Botet Escriba via Boost" <
> boost_at_[hidden]> wrote:
>
> More I think on the uninitialized default constructor, more I like it. No
> surprise.
> "Explicit is better than Implicit"
>
>
> If you ignore the fact that now everything has a precondition. If there is
> no sensible default, don't provide a default constructor​!
>

I could agree with you in some cases, but not in general.
What is the default for chrono::duration?
Does it means that we should remove the default constructor?

For the expected<T,E> case I believe I would prefer to have an
uninitialized constructor than don't having one. But I can understand
other have different view on that.

E.g. I would like to include expected on a c-like struct that is not
initialized at all and that the user initializes field by field. Not
having a default constructor will reduce the applicability of such a
vocabulary type a lot.

Vicente


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