Commit b416e70e by alokp@chromium.org

Some compilers do not support standard STL allocator interface. Also removed…

Some compilers do not support standard STL allocator interface. Also removed _Charalloc function only needed by VC++6.0, which we do not support. Submitted by Eagle.Lu. BUG=19 Review URL: http://codereview.appspot.com/1913048 git-svn-id: https://angleproject.googlecode.com/svn/trunk@380 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 434fdf21
......@@ -264,19 +264,26 @@ public:
template<class Other>
pool_allocator(const pool_allocator<Other>& p) : allocator(p.getAllocator()) { }
#if defined(__SUNPRO_CC) && !defined(_RWSTD_ALLOCATOR)
// libCStd on some platforms have a different allocate/deallocate interface.
// Caller pre-bakes sizeof(T) into 'n' which is the number of bytes to be
// allocated, not the number of elements.
void* allocate(size_type n) {
return getAllocator().allocate(n);
}
void* allocate(size_type n, const void*) {
return getAllocator().allocate(n);
}
void deallocate(void*, size_type) {}
#else
pointer allocate(size_type n) {
return reinterpret_cast<pointer>(getAllocator().allocate(n * sizeof(T)));
}
pointer allocate(size_type n, const void*) {
return reinterpret_cast<pointer>(getAllocator().allocate(n * sizeof(T)));
}
void deallocate(void*, size_type) { }
void deallocate(pointer, size_type) { }
pointer _Charalloc(size_t n) {
return reinterpret_cast<pointer>(getAllocator().allocate(n));
}
void deallocate(pointer, size_type) {}
#endif // _RWSTD_ALLOCATOR
void construct(pointer p, const T& val) { new ((void *)p) T(val); }
void destroy(pointer p) { p->T::~T(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment