C++20 std::allocator::rebind is deprecated
Library of generic, k-d tree multi-dimensional containers
Brought to you by:
bouhdevel
In std::allocator, the member rebind, construct and destroy were deprecated in C++20 and other allocators are doing the same (e.g. Intel OneTBB). A possible solution is:
- typedef typename Alloc::template rebind - <Kdtree_link<Key, Value> >::other Link_allocator; - typedef typename Alloc::template rebind - <value_type>::other Value_allocator; + using Link_allocator = std::allocator_traits<Alloc>::template rebind_alloc<Kdtree_link<Key, Value>>; + using Value_allocator = std::allocator_traits<Alloc>::template rebind_alloc<value_type>;
and
- get_value_allocator().construct(mutate_pointer(&safe.link->value), - value); + Value_allocator v_alloc = get_value_allocator(); + std::allocator_traits<Value_allocator>::construct(v_alloc, mutate_pointer(&safe.link->value), value);
Anonymous
Ok, I have a quick hack but I'll see if I can clean and complete it. It
will take some time as it's not a critical issue for me right now.
Regards.
On Wed, Mar 10, 2021 at 8:34 AM Sylvain Bougerel sylvain.bougerel@gmail.com
wrote:
Related
Bug Report: #6