template <typename T, typename Enable = void>
struct is_uniquely_represented
Defined at line 311 of file ../../third_party/abseil-cpp/absl/hash/internal/hash.h
is_uniquely_represented
`is_uniquely_represented
<T
>` is a trait class that indicates whether `T`
is uniquely represented.
A type is "uniquely represented" if two equal values of that type are
guaranteed to have the same bytes in their underlying storage. In other
words, if `a == b`, then `memcmp(
&a
,
&b
, sizeof(T))` is guaranteed to be
zero. This property cannot be detected automatically, so this trait is false
by default, but can be specialized by types that wish to assert that they are
uniquely represented. This makes them eligible for certain optimizations.
If you have any doubt whatsoever, do not specialize this template.
The default is completely safe, and merely disables some optimizations
that will not matter for most types. Specializing this template,
on the other hand, can be very hazardous.
To be uniquely represented, a type must not have multiple ways of
representing the same value; for example, float and double are not
uniquely represented, because they have distinct representations for
+0 and -0. Furthermore, the type's byte representation must consist
solely of user-controlled data, with no padding bits and no compiler-
controlled data such as vptrs or sanitizer metadata. This is usually
very difficult to guarantee, because in most cases the compiler can
insert data and padding bits at its own discretion.
If you specialize this template for a type `T`, you must do so in the file
that defines that type (or in this file). If you define that specialization
anywhere else, `is_uniquely_represented
<T
>` could have different meanings
in different places.
The Enable parameter is meaningless; it is provided as a convenience,
to support certain SFINAE techniques when defining specializations.