diff options
Diffstat (limited to 'experimental/ltalloc.hpp')
-rw-r--r-- | experimental/ltalloc.hpp | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/experimental/ltalloc.hpp b/experimental/ltalloc.hpp deleted file mode 100644 index cd6aee1..0000000 --- a/experimental/ltalloc.hpp +++ /dev/null @@ -1,59 +0,0 @@ -// based on code by Jerry Coffin (most likely Public Domain) -// - rlyeh - -#pragma once - -#include <stdlib.h> -#include <new> -#include <limits> - -#include "ltalloc.h" - -namespace lt { -template <class T> -struct allocator { - 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; - typedef T value_type; - - template <class U> struct rebind { typedef allocator<U> other; }; - allocator() throw() {} - allocator(const allocator&) throw() {} - - template <class U> allocator(const allocator<U>&) throw(){} - - ~allocator() throw() {} - - pointer address(reference x) const { return &x; } - const_pointer address(const_reference x) const { return &x; } - - pointer allocate(size_type s, void const * = 0) { - if (0 == s) - return NULL; - pointer temp = (pointer)ltmalloc(s * sizeof(T)); - if (temp == NULL) - throw std::bad_alloc(); - return temp; - } - - void deallocate(pointer p, size_type) { - ltfree(p); - } - - size_type max_size() const throw() { - return std::numeric_limits<size_t>::max() / sizeof(T); - } - - void construct(pointer p, const T& val) { - new((void *)p) T(val); - } - - void destroy(pointer p) { - p->~T(); - } -}; -} |