Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #68418

Re: Why allocator<T>::rebind<U> was removed with C++20`

From Bonita Montero <Bonita.Montero@gmail.com>
Newsgroups comp.lang.c++
Subject Re: Why allocator<T>::rebind<U> was removed with C++20`
Date 2019-09-14 20:49 +0200
Organization albasani.net
Message-ID <qljcn0$7a2$1@news.albasani.net> (permalink)
References <qlj9gc$d1h$1@news.albasani.net>

Show all headers | View raw


> #include <memory>
> 
> using my_allocator      = std::allocator<char>;
> using derived_allocator = my_allocator::rebind<int>::other;
> my_allocator      ma;
> derived_allocator da( ma );

I've got it; now it works like this:

#include <memory>

using my_allocator      = std::allocator<char>;
using derived_allocator = 
std::allocator_traits<my_allocator>::rebind_alloc<int>;
my_allocator      ma;
derived_allocator da( ma );

This unfortunately means that I've to specialize std::allocator_traits
for my NUMA-allocator. That's more work than simply implementing rebind
for my NUMA-allocator-class.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Why allocator<T>::rebind<U> was removed with C++20` Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-14 19:54 +0200
  Re: Why allocator<T>::rebind<U> was removed with C++20` Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-14 20:49 +0200
    Re: Why allocator<T>::rebind<U> was removed with C++20` Bo Persson <bo@bo-persson.se> - 2019-09-14 22:49 +0200
    Re: Why allocator<T>::rebind<U> was removed with C++20` Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-15 03:00 +0200

csiph-web