types: Support allocator rebinding
Avoid build failures with libc++ like:
include/c++/v1/vector:407:19: error: static assertion failed due to requirement 'is_same<ipmi::SecureAllocator<unsigned char>, std::allocator<unsigned char>>::value': [allocator.requirements] states that rebinding an allocator to the same type should result in the original allocator
407 | static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type> >::value,
Change-Id: I6f9637e2177669dce3509243135135a1b73fa9fe
Signed-off-by: Peter Foley <pefoley@google.com>
diff --git a/include/ipmid/types.hpp b/include/ipmid/types.hpp
index 98d0288..7b26b6f 100644
--- a/include/ipmid/types.hpp
+++ b/include/ipmid/types.hpp
@@ -270,6 +270,12 @@
class SecureAllocator : public std::allocator<T>
{
public:
+ template <typename U>
+ struct rebind
+ {
+ typedef SecureAllocator<U> other;
+ };
+
void deallocate(T* p, size_t n)
{
OPENSSL_cleanse(p, n);