-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
__is_trivially_equality_comparable is a trait that is true if a type is memcmp comarable for == and != against itself. We can use that on Clang along with existing metaprogramming.
This will allow covering more types like struct containing only integers with defaulted comparison and enums without user-defined comparison. This includes user defined types, for which this cannot be achieved without "magic". Also this includes standard types, such as chrono::duration or pair<int, int> if their comparison is defaulted properly; this should be less burden that specializing traits for them all.
A separate escape hatch could be a good idea, due to quasi-supporting old Clang and "new" Intel, which may not have __is_trivially_equality_comparable, or may have more bugs in it.
These algorithms can be improved:
-
equalfor all sizes -
search,find_end,adjacent_find,find_first_of,search_n,unique,unique_copyfor vector element sizes -
mismatchfor all sizes -
find,find_last,remove,remove_copy,countfor vector element sizes -
replacefor some vector element sizes (32-bit and 64-bit)