On 10 Jul 2014 at 23:48, Felipe Magno de Almeida wrote:
Nor are allocators consistently used for internals of STL containers. They have to be used for the type being stored of course, but internal data structures not exposed to external code may use any allocator e.g. malloc().
I thought this only applied to non-templated-on-allocator types. For example, list must use the allocator passed, rebound of course, to allocate its node. Or am I completely mistaken? If so then allocators are just fairy tale.
Of course it must. But if some implementation of list decided to keep some internal housekeeping data, it could use malloc or any other kind of allocator. For example some debug enhanced implementations keep additional debug info. The concurrent_unordered_map I am currently experimenting with uses the externally supplied allocator to allocate the value_type, but uses the default allocator for the bucket allocation. I believe this is permitted. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/