On Wed, Sep 23, 2015 at 12:29 PM, Ion GaztaƱaga
On 22/09/2015 18:41, Phil Endecott wrote:
According to the standard a container should allocate all memory from the allocator, I don't know if it should include temporary storage, I can't find anything explicit in the standard.
The issue is that we have no STL container that does something similar, it's hard to know what a user should expect. In any case, allocating temporary storage from the allocator or new/malloc in every range insertion sounds like a very good method to fragment memory.
I think it is fair to expect any memory allocations made by container are done through the allocator, whether these are for temporary use or not (well, except for exceptions and strings in them). This expectation is further reinforced with the addition of memory resource propagation, which allows to use the same allocator for the contained elements as well.