On 2017-08-18 19:50, Hans Dembinski wrote:
On 15. Aug 2017, at 02:51, Vladimir Batov via Boost
wrote: Given that it is policy-based I am hoping others might get interested writing additional policies within that framework such as COW or stack-based.
Can you use custom allocators for all policies?
Unfortunately no at the moment. It's been high on my TODO list... but given I do not use that functionality I've not had enough incentive implementing it. Still, I actually was reading about allocators right now. :-)
If so, then the behavior of the behavior of the "onstack" policy could be achieved by using a stack-based allocator, like the one from Howard, right?
I am not sure but I'd prefer if was possible. I see that impl_ptr::copied and impl_ptr::onstack are essentially identical... mem. management aside.
https://howardhinnant.github.io/stack_alloc.html
I think it is very elegant if one can switch to a stack-based version without huge code-refactoring if the performance need arises (I am paraphrasing your documentation).
Thank you for the link. Much appreciated. I'll most certainly read as it's what I've been scratching my head about for some time... Had a quick glance. I can be dead wrong but it does not seem (unfortunately) applicable to impl_ptr. It appears to be the standard allocator-usage pattern, i.e. I explicitly create an allocator (and memory arena) and then take from that arena. It's not applicable in the impl_ptr::onstack situation. Again, I'll have to read again.