aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2015-08-29 07:40:03 -0400
committerJack Lloyd <[email protected]>2015-08-29 07:40:03 -0400
commit6efa5a930c3f75b9203c27303448e602f8bc781c (patch)
tree47d3c7e0134f0a662efe7e6b2c125ab366e9c77f
parent1b5819fb2f1eca1ef6a58a9a3c8a6cd6291a6c17 (diff)
parent937426a903c2199fb677082f92038b14dc0b519e (diff)
Merge pull request #236 from bogiord/add-alloc-constructor
Make secure_allocator conforming with C++11 allocator concept. Add a template constructor and make the equality operators standard-compliant. Missing this broke iterator debugging with MSVC 2015.
-rw-r--r--src/lib/alloc/secmem.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/alloc/secmem.h b/src/lib/alloc/secmem.h
index 98707ad4e..63d4e5296 100644
--- a/src/lib/alloc/secmem.h
+++ b/src/lib/alloc/secmem.h
@@ -36,6 +36,9 @@ class secure_allocator
secure_allocator() BOTAN_NOEXCEPT {}
+ template<typename U>
+ secure_allocator(const secure_allocator<U>&) BOTAN_NOEXCEPT {}
+
~secure_allocator() BOTAN_NOEXCEPT {}
pointer address(reference x) const BOTAN_NOEXCEPT
@@ -82,12 +85,12 @@ class secure_allocator
template<typename U> void destroy(U* p) { p->~U(); }
};
-template<typename T> inline bool
-operator==(const secure_allocator<T>&, const secure_allocator<T>&)
+template<typename T, typename U> inline bool
+operator==(const secure_allocator<T>&, const secure_allocator<U>&)
{ return true; }
-template<typename T> inline bool
-operator!=(const secure_allocator<T>&, const secure_allocator<T>&)
+template<typename T, typename U> inline bool
+operator!=(const secure_allocator<T>&, const secure_allocator<U>&)
{ return false; }
template<typename T> using secure_vector = std::vector<T, secure_allocator<T>>;