Merge "Add a ZeroingAllocator::rebind<Other> for Other==char" into main am: c2b3fefa01 am: 727ef62350 am: e97cfd2d73 am: c836f0d085 am: f0241c612e

Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2673490

Change-Id: Ic98e20f951be0f01066874395f474cf210e18efd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/KeyBuffer.h b/KeyBuffer.h
index 4468220..3275255 100644
--- a/KeyBuffer.h
+++ b/KeyBuffer.h
@@ -19,6 +19,7 @@
 
 #include <string.h>
 #include <memory>
+#include <type_traits>
 #include <vector>
 
 namespace android {
@@ -31,6 +32,12 @@
         memset_explicit(p, 0, n);
         std::allocator<char>::deallocate(p, n);
     }
+
+    template <class Other>
+    struct rebind {
+        static_assert(std::is_same_v<char, Other>, "ZeroingAllocator is only defined for char");
+        using other = ZeroingAllocator;
+    };
 };
 
 // Char vector that zeroes memory when deallocating.