On Wed, Sep 23, 2015 at 2:36 PM, Ion GaztaƱaga
On 23/09/2015 12:59, Andrey Semashev wrote:
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.
This sounds reasonable. So in your opinion, get_temporary_storage() should be avoided?
Yes, I think so. Yet another reason to always rely on the allocator is that the user can supply his own allocator with special error reporting method (e.g. by throwing an application-specific exception instead of bad_alloc). The application may be expecting that the container will always report memory allocation errors in this special way.