The concepts specification has contained wording to permit default implementations of associated functions “forever”, which permits one to write concepts that state a set of related operations (e.g., == and !=) while only requiring that the user provide one of those operations. This allows algorithms to be expressed more cleanly without pushing many more requirements on the user. It’s somewhat like using <code>relops</code> in your algorithms or using the <a href=”http://www.boost.org/libs/utility/operators.htm”>Boost.Operators</a> library on your data types, but it applies only within constrained templates. For example, here we write the EqualityComparable concept with both != and ==, related through a default implementation:
auto concept EqualityComparable<typename T> {
bool operator==(T, T);
bool operator!=(T x, T y) { return !(x == y); }
}
This concept will match any type with a suitable operator==, whether or not it has an operator!=. If no operator!= exists, the default implementation of !(x == y) will be used instead. ConceptGCC now supports default implementations, with one caveat: late-checked concept map templates don’t seem to work well with default implementations of associated functions, yet.