Replace STL allocator with custom allocator

。_饼干妹妹 提交于 2019-12-02 16:50:17

问题


I followed this link: Replace default STL allocator

to replace the standard allocator with my own custom allocator. But I am getting this error:

/grid/common/pkgsData/gcc-v4.8.3/Linux/RHEL5.0-2010-x86_64/include/c++/4.8.3/bits/allocator.h:92:45: error: expected template-name before '<' token

class allocator: public __allocator_base<_Tp>
                                         ^

Somehow allocator.h file is not able to find out my custom allocator class. I used GCC:4.8.3 I added bits/ folder inside my source include folder, and created c++allocator.h. Inside this file defined marco similar to GCC provided c++allocator.h (https://gcc.gnu.org/onlinedocs/gcc-4.6.2/libstdc++/api/a00780_source.html).

#define __glibcxx_base_allocator my_allocator

my_allocator is my custom allocator.

来源:https://stackoverflow.com/questions/48603877/replace-stl-allocator-with-custom-allocator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!