diff --git a/bitmap_allocator.h b/bitmap_allocator.h index 7ffe39c..31860f8 100644 --- a/bitmap_allocator.h +++ b/bitmap_allocator.h @@ -359,11 +359,23 @@ namespace __gnu_cxx { void destroy(pointer __p) { __p->~T(); } - bitmap_allocator() throw() { } + bitmap_allocator() throw() { } + + bitmap_allocator(const bitmap_allocator&) throw() { } template bitmap_allocator(const bitmap_allocator&) throw() { } + pointer + address(reference __x) const { return std::__addressof(__x); } + + const_pointer + address(const_reference __x) const { return std::__addressof(__x); } + + size_type + max_size() const throw() + { return size_t(-1) / sizeof(T); } + T* allocate(size_t nobjs, const void* = 0) { return reinterpret_cast(this->impl.allocate(nobjs)); } @@ -376,6 +388,16 @@ namespace __gnu_cxx { template alloc_impl bitmap_allocator::impl; + template + inline bool + operator==(const bitmap_allocator&, const bitmap_allocator&) + { return true; } + + template + inline bool + operator!=(const bitmap_allocator&, const bitmap_allocator&) + { return false; } + } #endif // BITMAP_ALLOCATOR_H diff --git a/test.cpp b/test.cpp index 3bf5845..1d441bf 100644 --- a/test.cpp +++ b/test.cpp @@ -16,8 +16,8 @@ std::vector vpi; std::vector numbers; void test_list(int n) { - typedef bitmap_allocator alloc_t; - // typedef std::allocator alloc_t; + typedef bitmap_allocator alloc_t; + // typedef std::allocator alloc_t; typedef std::list list_t; list_t il; @@ -29,8 +29,8 @@ void test_list(int n) { } void test_alloc(int n) { - bitmap_allocator ia; - // std::allocator ia; + bitmap_allocator ia; + // std::allocator ia; for (int i = 0; i < n-1; ++i) { vpi.push_back(ia.allocate(1)); @@ -54,8 +54,8 @@ main() { } for (int i = 0; i < 24; ++i) { - // test_alloc(1<