You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on #126 I tested what happens if Ts are not Hashable.
Turns out the error messages are pretty bad - as expected.
This is true for all features relying on the underlying types. Could e.g. be comparing variants for equality and then variant's operator== fails to compile since the underlying types are not comparable.
Here is what we could do: emulate Concepts via Expression SFINAE and use them to provide beautiful error messages. Here is a first example of how this could look on the Hashable side:
./include/mapbox/variant.hpp:547:9: error: static assertion failed: type is not hashable
static_assert(is_hashable<T>::value, "type is not hashable");
instead of coming from deep down in the stdlib's btree implementation just because you tried to put a variant into an unordered set. Similarly this would work for equality etc.
Note: I'm not up to date on how far Expression SFINAE support is in Microsoft's VS, a couple of years ago is was a no go. Just something to be aware of. On the GCC / Clang side we're good.
Activity