On 7 September 2015 at 22:23, Ion Gaztañaga
Hi to all,
In case anyone is interested, I just committed to the develop branch the implementation of the proposal "N3916 Polymorphic Memory Resources - r2" that was included in the TS "C++ Extensions for Library Fundamentals". The library continues to support C++03 compilers.
It basically introduces in namespace boost::container::pmr and the path boost/container/pmr/:
- memory_resource - synchronized_pool_resource - unsynchronized_pool_resource - monotonic_buffer_resource - polymorphic_allocator - resource_adaptor - new_delete_resource / null_memory_resource / get_default_resource / set_default_resource - Aliases for all containers, using the polymorphic_allocator.
As default resource, new_delete_resource and null_memory_resource are required to be globals, they are implemented in the separately compiled boost.container library that was used to implement the DLMalloc-based extended allocator.
It seems that many users dislike building Boost libraries, but I felt this was the correct way to implement it. We could change or make it optionally header-only if there is demand. To avoid dependencies to some users, I made sure that memory_resource and resource_adaptor, which don't depend on the global default memory resource, can be used without linking the library.
Some logic was refactored from scoped_allocator_adaptor to avoid repeating the complicated template and preprocessor machinery in the polymorphic_allocator. I hope this does not cause any problem to scoped allocator users.
Any suggestion or bug report is welcome. Best,
Ion
Very nice! :D I should be able (as I was planning) to test this in a project but not before one or two months unfortunately. Also, you might want to notify people on the SG14 (low-latency/games) discussion group which focus on this kind of features, some of them might be able to test this earlier. Joël Lamotte