[Beignet] [PATCH 4/6] Android: derived the Allocator from std::allocator.
Yang Rong
rong.r.yang at intel.com
Mon Nov 9 18:40:15 PST 2015
There is a compiler error of Allocator::construct in android,
because Allocator only rewrite the Allocate::allocate and Allocate::deallocate,
so derived it from std::allocator
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
backend/src/sys/alloc.hpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/backend/src/sys/alloc.hpp b/backend/src/sys/alloc.hpp
index 6ee4e69..cc8aaac 100644
--- a/backend/src/sys/alloc.hpp
+++ b/backend/src/sys/alloc.hpp
@@ -121,7 +121,8 @@ namespace gbe
{
/*! STL compliant allocator to intercept all memory allocations */
template<typename T>
- class Allocator {
+ class Allocator : public std::allocator<T>
+ {
public:
typedef T value_type;
typedef value_type* pointer;
@@ -156,7 +157,6 @@ namespace gbe
INLINE size_type max_size(void) const {
return std::numeric_limits<size_type>::max() / sizeof(T);
}
- INLINE void construct(pointer p, const T& t = T()) { ::new(p) T(t); }
INLINE void destroy(pointer p) { p->~T(); }
INLINE bool operator==(Allocator const&) { return true; }
INLINE bool operator!=(Allocator const& a) { return !operator==(a); }
--
2.1.4
More information about the Beignet
mailing list