summaryrefslogtreecommitdiff
path: root/storage/innobase/include/mem0mem.h
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/include/mem0mem.h')
-rw-r--r--storage/innobase/include/mem0mem.h102
1 files changed, 0 insertions, 102 deletions
diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h
index 2cdb307ea96..a2d676e7f2a 100644
--- a/storage/innobase/include/mem0mem.h
+++ b/storage/innobase/include/mem0mem.h
@@ -27,9 +27,7 @@ Created 6/9/1994 Heikki Tuuri
#ifndef mem0mem_h
#define mem0mem_h
-#include "univ.i"
#include "ut0mem.h"
-#include "ut0byte.h"
#include "ut0rnd.h"
#include "mach0data.h"
@@ -418,104 +416,4 @@ struct mem_block_info_t {
UNIV_MEM_ALIGNMENT)
#include "mem0mem.ic"
-
-/** A C++ wrapper class to the mem_heap_t routines, so that it can be used
-as an STL allocator */
-template<typename T>
-class mem_heap_allocator
-{
-public:
- typedef T value_type;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef T* pointer;
- typedef const T* const_pointer;
- typedef T& reference;
- typedef const T& const_reference;
-
- mem_heap_allocator(mem_heap_t* heap) : m_heap(heap) { }
-
- mem_heap_allocator(const mem_heap_allocator& other)
- :
- m_heap(other.m_heap)
- {
- // Do nothing
- }
-
- template <typename U>
- mem_heap_allocator (const mem_heap_allocator<U>& other)
- :
- m_heap(other.m_heap)
- {
- // Do nothing
- }
-
- ~mem_heap_allocator() { m_heap = 0; }
-
- size_type max_size() const
- {
- return(ULONG_MAX / sizeof(T));
- }
-
- /** This function returns a pointer to the first element of a newly
- allocated array large enough to contain n objects of type T; only the
- memory is allocated, and the objects are not constructed. Moreover,
- an optional pointer argument (that points to an object already
- allocated by mem_heap_allocator) can be used as a hint to the
- implementation about where the new memory should be allocated in
- order to improve locality. */
- pointer allocate(size_type n)
- {
- return(reinterpret_cast<pointer>(
- mem_heap_alloc(m_heap, n * sizeof(T))));
- }
- pointer allocate(size_type n, const_pointer) { return allocate(n); }
-
- void deallocate(pointer, size_type) {}
-
- pointer address (reference r) const { return(&r); }
-
- const_pointer address (const_reference r) const { return(&r); }
-
- void construct(pointer p, const_reference t)
- {
- new (reinterpret_cast<void*>(p)) T(t);
- }
-
- void destroy(pointer p)
- {
- (reinterpret_cast<T*>(p))->~T();
- }
-
- /** Allocators are required to supply the below template class member
- which enables the possibility of obtaining a related allocator,
- parametrized in terms of a different type. For example, given an
- allocator type IntAllocator for objects of type int, a related
- allocator type for objects of type long could be obtained using
- IntAllocator::rebind<long>::other */
- template <typename U>
- struct rebind
- {
- typedef mem_heap_allocator<U> other;
- };
-
-private:
- mem_heap_t* m_heap;
- template <typename U> friend class mem_heap_allocator;
-};
-
-template <class T>
-bool operator== (const mem_heap_allocator<T>& left,
- const mem_heap_allocator<T>& right)
-{
- return(left.heap == right.heap);
-}
-
-template <class T>
-bool operator!= (const mem_heap_allocator<T>& left,
- const mem_heap_allocator<T>& right)
-{
- return(left.heap != right.heap);
-}
-
#endif