std::allocator_traits
works its magic automatically when I provide an STL-style container with an allocator that has a single template parameter but it doesn't when I provide an STL-style container with an allocator that has two template parameters but is otherwise similar.
What do I need to do to tell std::allocator_traits
how to interact with an allocator that has more than one template parameter? Is it possible to get std::allocator_traits
to provide reasonable defaults in this case?
As an example, if I take the simple allocator Howard Hinnant provides in Allocator Boilerplate and feed it to a std::vector<>
then all is well. If I add a dummy int
parameter to the allocator
template (and make slight modifications as needed) then I get compiler errors because the compiler couldn't find rebind
, among other things.
Here's that description in code:
http://coliru.stacked-crooked.com/a/173c57264137a351
If I have to specialize std::allocator_traits
myself in this case, is there a way to still get the defaults?