Closed kevin-- closed 2 years ago
Instead of trying to change std_allocator
, I would recommend writing a stateless RawAllocator
:
struct global_pool_allocator
{
void* allocate_node(std::size_t size, std::size_t alignment)
{
return globalInstance.allocate(...);
}
void deallocate_node(void *node, std::size_t size, std::size_t alignment) noexcept { … }
};
nice one. works great. Thank you
Hello, I'm in a bit of a bind where I need to use a
boost::icl::split_interval_map
with some custom allocators. The ICL library has not been updated in some time, so does not support the new C++11 style of allocators which may be stateful.My planned work around is to create a stateless allocator which can attach itself to the thread-local or global pre allocated RawAllocator in the constructor.
Roughly:
The failure occurs at this point
which reading the documentation does make sense, but I'm not completely sure how I'm meant to bridge this gap to make my
RawAllocator
properly stateless as required by the default constructor, or if there's another work around I should try. Any advice would be appreciated. Thank you.