Boost.Hana: boost::hana::detail::has_duplicates< T > Struct Template Reference
Boost , ,
Boost.Hana
1.0.1
Your standard library for metaprogramming
Возвращает ли любой из<T>s дубликат w.r.t.<hana::equal>.
В частности, это не проверяет, все ли<T>являются уникальными кактипы, а скорее, являются ли они уникальными по сравнению с<hana::equal(std::declval<T>(), std::declval<U>())>. Это предполагает сравнение с возвратом<IntegralConstant>, которое может быть явно преобразовано в<bool>.
Note
Since this utility is mostly used in assertions to check that there are no duplicates in a sequence, we expect it to return false most of the time (otherwise we will assert). Hence, this implementation is biased towards the fact that we will have to compare every pair of elements in most cases, and it does not try to be lazy.
This implementation is O(n^2). We could do it in O(n), but that would require a more elaborate setup including storage with O(1) lookup (which could be based on a compile-time hash). If we implement such storage for associative sequences, we could use it to optimize this.