Back to proposals-2013
Title: C++11 Rescues Allocators!
Proposer: alisdair_meredith
Type: Presentation
Duration: 90 minutes
Description:
Allocators are widely regarded as one of the less useful parts of the original
C++ standard library, yet all of the containers pay the cost of carrying an
allocator parameter. What could we do to make this feature genuinely useful
in C++11?
By introducing allocator traits, we make it much simpler to write new
allocators, while container authors should learn how to use these traits to
properly allocate and construct their elements under this new model. However,
the most important change is that the standard now guarantees it will make use
of the allocators you supply!
This session will show how the C++11 allocator framework fits together
(including the notion of allocator propagation), demonstrate how to write
simple allocators, and walk through the proper implemenation of an
allocator-aware container in C++11.
One key application of the new framework is to support the polymorphic allocator
model of Bloomberg's recently released open-sourced libraries. This model adds the important ability to select the appropriate allocator at run-time, rather
than compile-time, depending on the program's needs. This framework motivated
much of the design of the C++11 allocator facility, and will be used to
demonstrate how a comprehensive facility can be built cleanly on top of the
standard specification.
Roger: I think we want at most one of this one and “Allocators for Shared Memory in C++03, C++11, and Boost” …
Asti - Good point