Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#12459 closed Feature Requests (fixed)

Support polymorphic_allocator in boost::unordered_map/set

Reported by: skhoroshavin@… Owned by: Daniel James
Milestone: To Be Determined Component: unordered
Version: Boost 1.62.0 Severity: Problem
Keywords: Cc: skhoroshavin@…

Description

Right now boost::unordered_map/set require rebind struct in allocator, which is absent in polymorphic_allocator. This makes it impossible to use polymorphic_allocator "as is" in unordered containers.

Change History (5)

comment:1 by anonymous, 6 years ago

For now, you might be able to get it work by defining BOOST_UNORDERED_USE_ALLOCATOR_TRAITS to 1. That will tell it to use std::allocator_traits.

in reply to:  1 comment:2 by skhoroshavin@…, 6 years ago

Replying to anonymous:

For now, you might be able to get it work by defining BOOST_UNORDERED_USE_ALLOCATOR_TRAITS to 1. That will tell it to use std::allocator_traits.

Thanks for pointing, it solved the issue. However I think it would be much better if this was either documented or enabled by default for compilers supporting it.

comment:3 by anonymous, 6 years ago

The "for now" was to suggest that this is a temporary workaround. I can't do anything at the moment because we're at the end of a release cycle.

comment:4 by Daniel James, 6 years ago

Resolution: fixed
Status: newclosed

comment:5 by sergey.korytnik@…, 6 years ago

The same problem with boost::multi_index class. It expects Allocator::rebind struct.

Note: See TracTickets for help on using tickets.