From 03ba883ed53f545612edcd5a001990637bb72e38 Mon Sep 17 00:00:00 2001 From: Elliott Slaughter Date: Sun, 31 Mar 2024 14:28:10 -0700 Subject: [PATCH] Assert unique representation. --- src/hasher.inl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hasher.inl b/src/hasher.inl index 9cda8e9..1e90cb2 100644 --- a/src/hasher.inl +++ b/src/hasher.inl @@ -200,7 +200,9 @@ void Hasher::hash(const T &value) { template void Hasher::hash_value(const T &value) { + // Ensure we use this only on POD types with no padding. static_assert(std::is_trivially_copyable_v); + static_assert(std::has_unique_object_representations_v); buffer.write(reinterpret_cast(&value), sizeof(value)); }