diff --git a/libcxx/test/support/min_allocator.h b/libcxx/test/support/min_allocator.h index f3f08caa5568..b643636e1786 100644 --- a/libcxx/test/support/min_allocator.h +++ b/libcxx/test/support/min_allocator.h @@ -10,6 +10,34 @@ #ifndef MIN_ALLOCATOR_H #define MIN_ALLOCATOR_H +#include + +template +class bare_allocator +{ +public: + typedef T value_type; + + bare_allocator() {} + + template + bare_allocator(bare_allocator) {} + + T* allocate(std::size_t n) + { + return static_cast(::operator new(n*sizeof(T))); + } + + void deallocate(T* p, std::size_t) + { + return ::operator delete(static_cast(p)); + } + + friend bool operator==(bare_allocator, bare_allocator) {return true;} + friend bool operator!=(bare_allocator x, bare_allocator y) {return !(x == y);} +}; + + #if __cplusplus >= 201103L #include @@ -71,7 +99,7 @@ public: explicit min_pointer(min_pointer p) : ptr_(static_cast(p.ptr_)) {} explicit operator bool() const {return ptr_ != nullptr;} - + typedef std::ptrdiff_t difference_type; typedef T& reference; typedef T* pointer;