Replies: 1 comment 2 replies
-
Just realizing that this may be a problem specific to the string_view branch |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There are a couple of cases, where member function templates have constraints on the allowed template types (e.g.
detail::is_usable_as_key_type
). Those are usually expressed via sfinae, which will remove that template from the overload set if the constraint is not satisfied.Imho that only makes sense, when the intention is to have multiple member function templates and activate one or the other depending on the parameter type. For things as the above mentioned
detail::is_usable_as_key_type
that have to be true for any overload, I think it is more sensible to have a static_assert inside the function, because it is a hard error to pass such a type.That way the lib can give the user a clear error message that he tried to pass an illegal type instead of hoping that the compiler will produce a readable error message while listing all the possible overloads that fail to satisfy the constraint and the user trying to figure out, which was the desired overload.
Beta Was this translation helpful? Give feedback.
All reactions