3 ms·
C++ concepts have the same problem. In practice is a non-issue for the language because templates already had this issue. In old-school C++ you would probably
by nly 2y ago
C++ concepts have the same problem. In practice is a non-issue for the language because templates already had this issue.
In old-school C++ you would probably handle this with traits. I.e. a specialization of a tag type that can be written by either the class author or a third party that indicates a types semantic compatibility with a concept.
Example: specialising std::hash instead of forcing everyone to add hashCode() members
- gpderetta 2y agoAnd you can implement pseudo-nominal conformance to a concept Foo by requiring the presence of a 'yes_this_class_really_conforms_to_Foo' tag.