Boost logo

Boost :

Subject: Re: [boost] [outcome] Possible extensions/changes to std::experimental::expected
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-05-25 14:55:03


> 4. About comparisons
>
> Outcome doesn't implement comparisons between Outcomes. He pretend that
> we don't need them.

I don't pretend we don't need them. I say that people who store Expected
in an associative map need their head examined. And if they really,
really want to, they can supply a custom comparison function to the map.
We don't need default ordering operators if it means losing implicit
conversion and creating yet more needless boilerplate for end users.

> 5. About the exception to throw
>
> std::experimental::expected throw bad_expected_access<E>. I adopted the
> design of optional and bad_optional_access
>
> We could have as well a bad_expected_access_base class as Outcome has.
>
> My question is why don't throw directly E?

Throwing types without a vtable is punished badly in optimisation by
some compilers e.g. GCC. Before you ask, no I don't know why.

Throwing types not derived from std::exception I think that ship sailed
from C++ a long time ago. I think WG21 would vote against it.

Niall

-- 
ned Productions Limited Consulting
http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/

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