2015-12-05 15:03 GMT+01:00 Agustín K-ballo Bergé
I found an unusual pattern in the code, where memory is allocated via an allocator's `allocate` but afterwards `construct` is side-stepped and placement new is used instead. This breaks proper allocator support. Curiously `destroy` is correctly used down the line.
allocators: classes fixedsize_stack/segmented_stack etc. are not allocators you know by the C++standard(s). those classes are used to allocate stack space. The classes make use of fucntionallity not common for allocators you have had in mind - for instance adding a protected page at the end or using splitstack-functions like __splitstack_makecontext).
Furthermore, from a cursory look it seems C++11 allocators are not supported. The code assumes a C++03 allocator interface. If it is intentional then this requirement should be documented.
In class promise and packaged_task probably simply copy&paste the code from the StackAllocator snippets. What's wrong with allocator::allocate() + placement new instead of allocator::allocate() + allocator::construct()?