boost::variantaims to be a more general purpose variant from what I understand, and I don’t know whether it’s possible to make its implementation
constexpr. Are there significant differences between your variant and e.g.
variant<int, char> v = 42; variant<int, char, double> v2 = v;
hana::uniqueexample does not work with clang 4.0.0? http://melpon.org/wandbox/permlink/iMBBa9vrZWZbns2N
is_empty(set)to work; see boostorg/hana#196.
std::sethas a single element is a runtime property, while the concepts that it model is a property of the type system, which allows you to reason about your code.
The items contained in a set have no specified order so you can't technically rely on any one item being in "front". That being said you could use
Foldable. Something like:
This would fail just like
hana::front would if the
set was empty.
insertis what I did in the above link.
*are defined (see that #if 1). Do you think it is a hana bug or gcc bug? Because cang does compile this. :-)
operator*with a fully unconstrained template parameter.
std::addressofbecause I never thought someone would be crazy enough to have such an overload, and I try to minimize the number of function templates that are instantiated to keep the compile-times down. As to why I’m not using a reference, I left this comment in the code:
// We use a pointer instead of a reference to avoid a Clang ICE.