Thread: [Spatial] [spatial:tickets] #6 C++20 std::allocator::rebind is deprecated
Library of generic, k-d tree multi-dimensional containers
Brought to you by:
bouhdevel
From: Dario M. <dm...@us...> - 2021-03-06 15:07:34
|
--- ** [tickets:#6] C++20 std::allocator::rebind is deprecated** **Status:** open **Milestone:** 2.1.9 **Created:** Sat Mar 06, 2021 03:07 PM UTC by Dario Mariani **Last Updated:** Sat Mar 06, 2021 03:07 PM UTC **Owner:** nobody 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); ~~~ --- Sent from sourceforge.net because spa...@li... is subscribed to https://sourceforge.net/p/spatial/tickets/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/spatial/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: Sylvain B. <syl...@gm...> - 2021-03-10 11:34:28
|
Hi Dario, Thanks for the notification, I have not updated the library for a while now, and I definitely should but do not have much time. Would you like to do it? Regards, Sylvain On Sat, Mar 6, 2021 at 11:07 PM Dario Mariani via Spatial-main < spa...@li...> wrote: > ------------------------------ > > * [tickets:#6] <https://sourceforge.net/p/spatial/tickets/6/> C++20 > std::allocator::rebind is deprecated* > > *Status:* open > *Milestone:* 2.1.9 > *Created:* Sat Mar 06, 2021 03:07 PM UTC by Dario Mariani > *Last Updated:* Sat Mar 06, 2021 03:07 PM UTC > *Owner:* nobody > > 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); > > ------------------------------ > > Sent from sourceforge.net because spa...@li... is > subscribed to https://sourceforge.net/p/spatial/tickets/ > > To unsubscribe from further messages, a project admin can change settings > at https://sourceforge.net/p/spatial/admin/tickets/options. Or, if this > is a mailing list, you can unsubscribe from the mailing list. > _______________________________________________ > Spatial-main mailing list > Spa...@li... > https://lists.sourceforge.net/lists/listinfo/spatial-main > |
From: Darío M. <mar...@gm...> - 2021-03-10 17:55:31
|
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 <syl...@gm...> wrote: > Hi Dario, > > Thanks for the notification, I have not updated the library for a while > now, and I definitely should but do not have much time. Would you like to > do it? > > Regards, > Sylvain > > On Sat, Mar 6, 2021 at 11:07 PM Dario Mariani via Spatial-main < > spa...@li...> wrote: > >> ------------------------------ >> >> * [tickets:#6] <https://sourceforge.net/p/spatial/tickets/6/> C++20 >> std::allocator::rebind is deprecated* >> >> *Status:* open >> *Milestone:* 2.1.9 >> *Created:* Sat Mar 06, 2021 03:07 PM UTC by Dario Mariani >> *Last Updated:* Sat Mar 06, 2021 03:07 PM UTC >> *Owner:* nobody >> >> 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); >> >> ------------------------------ >> >> Sent from sourceforge.net because spa...@li... is >> subscribed to https://sourceforge.net/p/spatial/tickets/ >> >> To unsubscribe from further messages, a project admin can change settings >> at https://sourceforge.net/p/spatial/admin/tickets/options. Or, if this >> is a mailing list, you can unsubscribe from the mailing list. >> _______________________________________________ >> Spatial-main mailing list >> Spa...@li... >> https://lists.sourceforge.net/lists/listinfo/spatial-main >> > |