[03/10] Android: derived the Allocator from std::allocator.

Submitted by Yang, Rong R on May 19, 2016, 8:37 a.m.

Details

Message ID 1463647036-25545-3-git-send-email-rong.r.yang@intel.com
State New
Headers show
Series "Series without cover letter" ( rev: 2 1 ) in Beignet

Not browsing as part of any series.

Commit Message

Yang, Rong R May 19, 2016, 8:37 a.m.
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@intel.com>
---
 backend/src/sys/alloc.hpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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); }