2016-09-21 18:35 GMT+02:00 Niall Douglas
On 16 Sep 2016 at 15:23, Andrzej Krzemienski wrote:
An example use case:
typedef markable
> opt_int; opt_int oi; opt_int o2 (2); assert (!oi.has_value());assert (o2.has_value());assert (o2.value() == 2); static_assert (sizeof(opt_int) == sizeof(int), "");
I'm not sure about the value add of this simplified optional implementation. What compelling use cases does it have over optional?
Compared to optional:
1. no spacial overhead for storing "initialized" flag:
sizeof(markable
specialisations of basic_monad
and has all the advantages of being a basic_monad, including implicit convertibility to more expressive basic_monad's, monadic operators etc. It also has the same ridiculous optimisability that basic_monad has and typically reduces down to no runtime overhead (which from inspection so does your markable). Yours does have likely very low impact on compile times though. Mine does stress the optimiser in release builds a lot.
Compared to boost::outcome::option? I do not know boost::outcome::option that well? Are its characteristics documented anywhere? Thank you for response, &rzej