
On 16 Sep 2016 at 15:23, Andrzej Krzemienski wrote:
An example use case:
typedef markable<mark_int<int, -1>> 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? In my own boost::outcome::option<T>, it's just one of many specialisations of basic_monad<T, EC, E> 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. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/