That is why there is a type of re-binding . It allows you to create a similar allocator that instead allocates something else (for example, node<T> ).
Mostly like this:
std::allocator<int> int_alloc; std::allocator<int>::rebind<node<int>> node_alloc; //Perhaps more useful: decltype(int_alloc)::rebind<node<int>> node_alloc;
Of course, in a real situation, all this will be a template, but I hope this shows the idea.
Read the notes and examples here for more information.
source share