#ifndef _ARRAY_ALLOCATOR_H_ #define _ARRAY_ALLOCATOR_H_ template class array_allocator { private: T array[size]; 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; pointer address(reference r) const { return &r; } const_pointer address(const_reference r) const { return &r; } array_allocator() throw(){} template array_allocator(const array_allocator& ) throw() {} ~array_allocator() throw(){} pointer allocate(size_type n, const void* = 0) { return array; } void deallocate(pointer p, size_type) { } //Use placement new to engage the constructor void construct(pointer p, const T& val) { new((void*)p) T(val); } void destroy(pointer p){ ((T*)p)->~T(); } size_type max_size() const throw() {return size;} template struct rebind { typedef array_allocator other; }; }; template struct array_vector : std::vector > { }; #if defined(__INTEL_COMPILER) || defined(__GNUC__) || (_MSC_VER>=1300) template struct allocator_traits > {enum {is_static=true};}; #endif #endif