
On 06/28/2015 03:38 AM, Vicente J. Botet Escriba wrote:
Le 27/06/15 21:32, Agustín K-ballo Bergé a écrit :
On 6/27/2015 12:38 PM, Vicente J. Botet Escriba wrote:
I would accept Eggs.Variant without even a review (or with a minimal review) as an experimental library as part of Boost.Variant after some minimal adaptation to fit in Boost of course. [snip] I know that your variant is possibly empty and the C++ standard proposal is never-empty, and this makes them different from the user point of view. Bjarne S. and Anthony W. are pushing towards a possible empty variant, we don't know yet what the std::experimental::variant will be and less yet what std::variant will be in C++17.
boost::variant combined with boost::blanc gives this kind of possibly empty variant, but IMHO this is a quite different type.
template <class ...Ts> using optional_variant = boost::variant<boost::blanc, Ts...>; // +/-
I suggest to name them as variant<Ts...> : never-empty
What about variant<>, or is that disallowed? If it is disallowed, then tuple<> should, I guess, also be disallowed. FWIW, there was some discussion of the meaning of variant<> and tuple<> in the haskellforall page: http://www.haskellforall.com/2012/01/haskell-for-mainstream-programmers.html IOW, maybe: variant<> is somewhat like the Zero and tuple<> is somewhat like the One in that haskellforall page. Just thought it interesting, but I've no idea if Zero or One would be useful in c++. Anyone have any ideas about how they would be useful?
optionals<Ts...> : possibly empty
I believe that the usage of these classes is quite different.
[snip]