The page:
http://ldionne.com/hana/structboost_1_1hana_1_1Either.html
contains:
An Either contains either a left value or a right value,
both of which may have different data types. An Either
containing a left value a is represented as left(a), and
an Either containing a right value b is represented as
right(b).
which makes anyone familiar with boost::variant to think
that hana's Either is simply a binary boost::variant, and
left(a) ~=~ variant(a)
right(b) ~=~ variant(b)
where ~=~ means some sort of similarity. However, since
the left and right functions only have 1 argument and no
template arguments, they can't produce something like
variant where the left and right types are known.
IOW, it seems that left and right are just wrapper's around
the types. Looking at the code, the wrappers, _left and
_right are defined here:
https://github.com/ldionne/hana/blob/master/include/boost/hana/either.hpp#L3...
https://github.com/ldionne/hana/blob/master/include/boost/hana/either.hpp#L7...
But why should Either be limited just to _left and _right
wrappers. Why not provide wrapper's tagged by some
enumerable? For example, something like this:
template
< typename X
, typename Enumerable=unsigned
, Enumerable tag=Tag()
>
struct _tagged //instead of _left and _right
: operators::adl
{
X value;
.
.
.
template